Upload 4 files
Browse files- gss-sdk.js +2 -2
- sdk/gss-sdk.js +2 -2
- server.js +1 -1
gss-sdk.js
CHANGED
|
@@ -143,8 +143,8 @@ class GSSClient {
|
|
| 143 |
body: JSON.stringify(body),
|
| 144 |
});
|
| 145 |
|
| 146 |
-
// If JWT expired
|
| 147 |
-
if (res.status === 401) {
|
| 148 |
localStorage.removeItem(this.storageKey);
|
| 149 |
this._token = null;
|
| 150 |
return this.chat(messages, opts);
|
|
|
|
| 143 |
body: JSON.stringify(body),
|
| 144 |
});
|
| 145 |
|
| 146 |
+
// If JWT rejected (expired or invalid), clear cache and retry once
|
| 147 |
+
if (res.status === 401 || res.status === 403) {
|
| 148 |
localStorage.removeItem(this.storageKey);
|
| 149 |
this._token = null;
|
| 150 |
return this.chat(messages, opts);
|
sdk/gss-sdk.js
CHANGED
|
@@ -143,8 +143,8 @@ class GSSClient {
|
|
| 143 |
body: JSON.stringify(body),
|
| 144 |
});
|
| 145 |
|
| 146 |
-
// If JWT expired
|
| 147 |
-
if (res.status === 401) {
|
| 148 |
localStorage.removeItem(this.storageKey);
|
| 149 |
this._token = null;
|
| 150 |
return this.chat(messages, opts);
|
|
|
|
| 143 |
body: JSON.stringify(body),
|
| 144 |
});
|
| 145 |
|
| 146 |
+
// If JWT rejected (expired or invalid), clear cache and retry once
|
| 147 |
+
if (res.status === 401 || res.status === 403) {
|
| 148 |
localStorage.removeItem(this.storageKey);
|
| 149 |
this._token = null;
|
| 150 |
return this.chat(messages, opts);
|
server.js
CHANGED
|
@@ -97,7 +97,7 @@ class GSSClient {
|
|
| 97 |
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
| 98 |
body: JSON.stringify(body),
|
| 99 |
});
|
| 100 |
-
if (res.status === 401) {
|
| 101 |
localStorage.removeItem(this.storageKey);
|
| 102 |
this._token = null;
|
| 103 |
return this.chat(messages, opts);
|
|
|
|
| 97 |
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
| 98 |
body: JSON.stringify(body),
|
| 99 |
});
|
| 100 |
+
if (res.status === 401 || res.status === 403) {
|
| 101 |
localStorage.removeItem(this.storageKey);
|
| 102 |
this._token = null;
|
| 103 |
return this.chat(messages, opts);
|