@mindline/sync 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/hybridspa.ts +4 -4
  2. package/package.json +1 -1
package/hybridspa.ts CHANGED
@@ -91,8 +91,8 @@ function seeProfile(spaCode: string, instance: IPublicClientApplication) {
91
91
  export async function getTenantInfo(user: User, instance: IPublicClientApplication) {
92
92
  debugger;
93
93
 
94
- // do we already have it?
95
- if(user.companyName != "" && user.companyDomain != "") return;
94
+ // do we already have a valid company name?
95
+ if (typeof user.companyName !== 'undefined' && user.companyName !== "") return;
96
96
 
97
97
  // create tenant info endpoint
98
98
  var tenantEndpoint = graphConfig.graphTenantEndpoint;
@@ -103,7 +103,7 @@ export async function getTenantInfo(user: User, instance: IPublicClientApplicati
103
103
  console.log("Tenant Info Endpoint: " + tenantEndpoint);
104
104
 
105
105
  // if needed, retrieve and cache access token
106
- if (user.accessToken === "") {
106
+ if (typeof user.accessToken === 'undefined' || user.accessToken === "") {
107
107
  try {
108
108
  let response = await instance.acquireTokenByCode({ code: user.spacode });
109
109
  user.accessToken = response.accessToken;
@@ -123,7 +123,7 @@ export async function getTenantInfo(user: User, instance: IPublicClientApplicati
123
123
  try {
124
124
  let response = await fetch(tenantEndpoint, options);
125
125
  let data = await response.json();
126
- if(data.displayName !== undefined)
126
+ if(data && data.displayName && data.displayName !== undefined)
127
127
  {
128
128
  user.companyName = data.displayName;
129
129
  user.companyDomain = data.defaultDomainName;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.26",
4
+ "version": "1.0.28",
5
5
  "types": "index.d.ts",
6
6
  "exports": "./index.ts",
7
7
  "description": "sync is a node.js package encapsulating javscript classes required for configuring Mindline sync service.",