@canmingir/link 1.2.52 → 1.2.53
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/package.json +1 -1
- package/src/http/index.js +12 -17
package/package.json
CHANGED
package/src/http/index.js
CHANGED
|
@@ -40,9 +40,8 @@ instance.interceptors.response.use(
|
|
|
40
40
|
async (error) => {
|
|
41
41
|
publish("LOADED", { loading: false });
|
|
42
42
|
const statusCode = error.response?.status;
|
|
43
|
-
const identityProvider = storage.get("link", "identityProvider");
|
|
44
43
|
|
|
45
|
-
if (statusCode === 500
|
|
44
|
+
if (statusCode === 500) {
|
|
46
45
|
const token = storage.get("link", "accessToken");
|
|
47
46
|
try {
|
|
48
47
|
const decodedToken = jwtDecode(token);
|
|
@@ -155,22 +154,18 @@ refreshInterceptor(instance, refreshAuthLogic, {
|
|
|
155
154
|
return false;
|
|
156
155
|
}
|
|
157
156
|
|
|
158
|
-
if (identityProvider === "DEMO") {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
try {
|
|
164
|
-
const decodedToken = jwtDecode(token);
|
|
165
|
-
return decodedToken.exp * 1000 < Date.now();
|
|
166
|
-
} catch (_) {
|
|
167
|
-
// If we can't decode, attempt refresh once.
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
157
|
+
if (identityProvider === "DEMO") {
|
|
158
|
+
if (statusCode !== 500) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
171
161
|
|
|
172
|
-
|
|
173
|
-
|
|
162
|
+
try {
|
|
163
|
+
const decodedToken = jwtDecode(token);
|
|
164
|
+
return decodedToken.exp * 1000 < Date.now();
|
|
165
|
+
} catch (_) {
|
|
166
|
+
// If we can't decode, attempt refresh once.
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
174
169
|
}
|
|
175
170
|
|
|
176
171
|
try {
|