arcadible 1.0.7 → 1.0.8
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/account.js +15 -5
package/package.json
CHANGED
package/src/account.js
CHANGED
|
@@ -168,10 +168,13 @@ const get = function (onRefresh) {
|
|
|
168
168
|
// [function]
|
|
169
169
|
|
|
170
170
|
// a failed request's handler for commands that send the saved session's
|
|
171
|
-
// token
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
171
|
+
// token. The API refuses it (401) only when Supabase does: for a deleted
|
|
172
|
+
// account, or a token that expired by the server's clock though not by
|
|
173
|
+
// this one's. A refresh tells them apart: refused, the session is over, so
|
|
174
|
+
// it's removed and the error says to log in (session_expired); renewed, the
|
|
175
|
+
// session is kept, and the request's own error stands, so running the
|
|
176
|
+
// command again works. An ARC_TOKEN's refusal stays as it is, since logging
|
|
177
|
+
// in doesn't change the token.
|
|
175
178
|
const ended = function (current) {
|
|
176
179
|
return (ex) => {
|
|
177
180
|
if (
|
|
@@ -182,7 +185,14 @@ const ended = function (current) {
|
|
|
182
185
|
) {
|
|
183
186
|
throw ex;
|
|
184
187
|
}
|
|
185
|
-
return
|
|
188
|
+
return refresh(current).then(
|
|
189
|
+
() => {
|
|
190
|
+
throw ex;
|
|
191
|
+
},
|
|
192
|
+
(refreshEx) => {
|
|
193
|
+
throw refreshEx instanceof ArcError ? refreshEx : ex;
|
|
194
|
+
},
|
|
195
|
+
);
|
|
186
196
|
};
|
|
187
197
|
};
|
|
188
198
|
|