@etsoo/materialui 1.4.55 → 1.4.57
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/lib/app/ServiceApp.d.ts +0 -7
- package/lib/app/ServiceApp.js +8 -16
- package/package.json +1 -1
- package/src/app/ServiceApp.ts +13 -21
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -47,13 +47,6 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
|
|
|
47
47
|
* @param action Callback
|
|
48
48
|
*/
|
|
49
49
|
signout(action?: () => void | boolean): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* User login extended
|
|
52
|
-
* @param user New user
|
|
53
|
-
* @param refreshToken Refresh token
|
|
54
|
-
* @param dispatch User state dispatch
|
|
55
|
-
*/
|
|
56
|
-
userLogin(user: U, refreshToken: string, dispatch?: boolean): void;
|
|
57
50
|
/**
|
|
58
51
|
*
|
|
59
52
|
* @param user Current user
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -106,12 +106,13 @@ export class ServiceApp extends ReactApp {
|
|
|
106
106
|
return super.signout(action);
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
110
|
-
* @param user
|
|
111
|
-
* @param
|
|
109
|
+
*
|
|
110
|
+
* @param user Current user
|
|
111
|
+
* @param core Core system API token data
|
|
112
|
+
* @param keep Keep in local storage or not
|
|
112
113
|
* @param dispatch User state dispatch
|
|
113
114
|
*/
|
|
114
|
-
|
|
115
|
+
userLoginEx(user, core, dispatch) {
|
|
115
116
|
if (user.clientDeviceId && user.passphrase) {
|
|
116
117
|
// Save the passphrase
|
|
117
118
|
// Interpolated string expressions are different between TypeScript and C# for the null value
|
|
@@ -121,21 +122,10 @@ export class ServiceApp extends ReactApp {
|
|
|
121
122
|
this.updatePassphrase(passphrase);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
// Super call, set token
|
|
125
|
-
super.userLogin(user, refreshToken, dispatch);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
* @param user Current user
|
|
130
|
-
* @param core Core system API token data
|
|
131
|
-
* @param keep Keep in local storage or not
|
|
132
|
-
* @param dispatch User state dispatch
|
|
133
|
-
*/
|
|
134
|
-
userLoginEx(user, core, dispatch) {
|
|
135
125
|
// User login
|
|
136
126
|
const { refreshToken } = user;
|
|
137
|
-
this.userLogin(user, refreshToken, dispatch);
|
|
138
127
|
// Core system login
|
|
128
|
+
// It's the extreme case, the core system token should not be the same with the current app user token
|
|
139
129
|
core ??= {
|
|
140
130
|
refreshToken,
|
|
141
131
|
accessToken: user.token,
|
|
@@ -144,6 +134,8 @@ export class ServiceApp extends ReactApp {
|
|
|
144
134
|
};
|
|
145
135
|
// Cache the core system data
|
|
146
136
|
this.saveCoreToken(core);
|
|
137
|
+
// User login and trigger the dispatch at last
|
|
138
|
+
this.userLogin(user, refreshToken, dispatch);
|
|
147
139
|
}
|
|
148
140
|
/**
|
|
149
141
|
* Save core system data
|
package/package.json
CHANGED
package/src/app/ServiceApp.ts
CHANGED
|
@@ -139,12 +139,17 @@ export class ServiceApp<
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
143
|
-
* @param user
|
|
144
|
-
* @param
|
|
142
|
+
*
|
|
143
|
+
* @param user Current user
|
|
144
|
+
* @param core Core system API token data
|
|
145
|
+
* @param keep Keep in local storage or not
|
|
145
146
|
* @param dispatch User state dispatch
|
|
146
147
|
*/
|
|
147
|
-
|
|
148
|
+
userLoginEx(
|
|
149
|
+
user: U & ServiceUserToken,
|
|
150
|
+
core?: ApiRefreshTokenDto,
|
|
151
|
+
dispatch?: boolean
|
|
152
|
+
) {
|
|
148
153
|
if (user.clientDeviceId && user.passphrase) {
|
|
149
154
|
// Save the passphrase
|
|
150
155
|
// Interpolated string expressions are different between TypeScript and C# for the null value
|
|
@@ -158,27 +163,11 @@ export class ServiceApp<
|
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
|
|
161
|
-
// Super call, set token
|
|
162
|
-
super.userLogin(user, refreshToken, dispatch);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
*
|
|
167
|
-
* @param user Current user
|
|
168
|
-
* @param core Core system API token data
|
|
169
|
-
* @param keep Keep in local storage or not
|
|
170
|
-
* @param dispatch User state dispatch
|
|
171
|
-
*/
|
|
172
|
-
userLoginEx(
|
|
173
|
-
user: U & ServiceUserToken,
|
|
174
|
-
core?: ApiRefreshTokenDto,
|
|
175
|
-
dispatch?: boolean
|
|
176
|
-
) {
|
|
177
166
|
// User login
|
|
178
167
|
const { refreshToken } = user;
|
|
179
|
-
this.userLogin(user, refreshToken, dispatch);
|
|
180
168
|
|
|
181
169
|
// Core system login
|
|
170
|
+
// It's the extreme case, the core system token should not be the same with the current app user token
|
|
182
171
|
core ??= {
|
|
183
172
|
refreshToken,
|
|
184
173
|
accessToken: user.token,
|
|
@@ -188,6 +177,9 @@ export class ServiceApp<
|
|
|
188
177
|
|
|
189
178
|
// Cache the core system data
|
|
190
179
|
this.saveCoreToken(core);
|
|
180
|
+
|
|
181
|
+
// User login and trigger the dispatch at last
|
|
182
|
+
this.userLogin(user, refreshToken, dispatch);
|
|
191
183
|
}
|
|
192
184
|
|
|
193
185
|
/**
|