@geexcode/geex-angular 0.0.18 → 0.0.20

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.
package/dist/index.js CHANGED
@@ -67,7 +67,15 @@ var OrgTypeEnum = {
67
67
  Default: "Default"
68
68
  };
69
69
  var GQL_CHECK_TENANT = import_graphql_tag.default`mutation checkTenant($code: String!) { checkTenant(code: $code) { id code name isEnabled createdOn } }`;
70
- var GQL_FEDERATE_AUTH = import_graphql_tag.default`mutation federateAuthenticate($code: String!, $loginProvider: LoginProviderEnum!) { federateAuthenticate(code: $code, loginProvider: $loginProvider) { id orgs { code name allParentOrgs { id orgType code name parentOrgCode } } isEnable permissions orgCodes roleIds roleNames loginProvider } }`;
70
+ var GQL_FEDERATE_AUTH = import_graphql_tag.default`
71
+ mutation federateAuthenticate($code: String!, $loginProvider: LoginProviderEnum!) { federateAuthenticate(code: $code, loginProvider: $loginProvider) {
72
+ token loginProvider userId name userId user {
73
+ id username nickname phoneNumber email isEnable openId loginProvider roleNames roleIds isEnable permissions orgCodes avatarFileId
74
+ avatarFile { url }
75
+ orgs { allParentOrgs { code name } name code }
76
+ claims { claimType claimValue }
77
+ avatarFile { id createdOn fileSize mimeType storageType fileName md5 url }
78
+ }} }`;
71
79
  var GQL_ON_PUBLIC_NOTIFY = import_graphql_tag.default`subscription onPublicNotify { onPublicNotify { __typename ... on DataChangeClientNotify { dataChangeType } } }`;
72
80
  var GQL_ORGS_CACHE = import_graphql_tag.default`query orgsCache { orgs(take: 999) { items { id orgType code name parentOrgCode } } }`;
73
81
  var GQL_INIT_SETTINGS = import_graphql_tag.default`query initSettings { initSettings { id name value } }`;
@@ -107,6 +115,9 @@ function createAuthModule(injector) {
107
115
  async loadUserData() {
108
116
  const oAuthService = injector.get(import_angular_oauth2_oidc.OAuthService);
109
117
  try {
118
+ if (!oAuthService.hasValidIdToken()) {
119
+ return void 0;
120
+ }
110
121
  await oAuthService.loadUserProfile();
111
122
  const profile = oAuthService.getIdentityClaims();
112
123
  if (profile && oAuthService.hasValidAccessToken()) {
@@ -121,7 +132,6 @@ function createAuthModule(injector) {
121
132
  }
122
133
  } catch (err) {
123
134
  console.error(err);
124
- oAuthService.logOut();
125
135
  }
126
136
  return void 0;
127
137
  }
package/dist/index.mjs CHANGED
@@ -22,7 +22,15 @@ var OrgTypeEnum = {
22
22
  Default: "Default"
23
23
  };
24
24
  var GQL_CHECK_TENANT = gql`mutation checkTenant($code: String!) { checkTenant(code: $code) { id code name isEnabled createdOn } }`;
25
- var GQL_FEDERATE_AUTH = gql`mutation federateAuthenticate($code: String!, $loginProvider: LoginProviderEnum!) { federateAuthenticate(code: $code, loginProvider: $loginProvider) { id orgs { code name allParentOrgs { id orgType code name parentOrgCode } } isEnable permissions orgCodes roleIds roleNames loginProvider } }`;
25
+ var GQL_FEDERATE_AUTH = gql`
26
+ mutation federateAuthenticate($code: String!, $loginProvider: LoginProviderEnum!) { federateAuthenticate(code: $code, loginProvider: $loginProvider) {
27
+ token loginProvider userId name userId user {
28
+ id username nickname phoneNumber email isEnable openId loginProvider roleNames roleIds isEnable permissions orgCodes avatarFileId
29
+ avatarFile { url }
30
+ orgs { allParentOrgs { code name } name code }
31
+ claims { claimType claimValue }
32
+ avatarFile { id createdOn fileSize mimeType storageType fileName md5 url }
33
+ }} }`;
26
34
  var GQL_ON_PUBLIC_NOTIFY = gql`subscription onPublicNotify { onPublicNotify { __typename ... on DataChangeClientNotify { dataChangeType } } }`;
27
35
  var GQL_ORGS_CACHE = gql`query orgsCache { orgs(take: 999) { items { id orgType code name parentOrgCode } } }`;
28
36
  var GQL_INIT_SETTINGS = gql`query initSettings { initSettings { id name value } }`;
@@ -62,6 +70,9 @@ function createAuthModule(injector) {
62
70
  async loadUserData() {
63
71
  const oAuthService = injector.get(OAuthService);
64
72
  try {
73
+ if (!oAuthService.hasValidIdToken()) {
74
+ return void 0;
75
+ }
65
76
  await oAuthService.loadUserProfile();
66
77
  const profile = oAuthService.getIdentityClaims();
67
78
  if (profile && oAuthService.hasValidAccessToken()) {
@@ -76,7 +87,6 @@ function createAuthModule(injector) {
76
87
  }
77
88
  } catch (err) {
78
89
  console.error(err);
79
- oAuthService.logOut();
80
90
  }
81
91
  return void 0;
82
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geexcode/geex-angular",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Angular adapter for Geex core.",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.cjs",