@data-fair/lib-vue 1.24.1 → 1.24.2
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/session.js +5 -4
package/package.json
CHANGED
package/session.js
CHANGED
|
@@ -269,7 +269,9 @@ export async function getSession(initOptions) {
|
|
|
269
269
|
goTo(null);
|
|
270
270
|
};
|
|
271
271
|
const keepalive = async () => {
|
|
272
|
-
|
|
272
|
+
// check cookies.get('id_token') not state.user so that we do a keepalive on expired id tokens
|
|
273
|
+
// as we might have an exchange token
|
|
274
|
+
if (!cookies.get('id_token'))
|
|
273
275
|
return;
|
|
274
276
|
if (!ssr) {
|
|
275
277
|
window.localStorage.setItem('sd-keepalive' + options.sitePath, `${new Date().getTime()}`);
|
|
@@ -284,8 +286,8 @@ export async function getSession(initOptions) {
|
|
|
284
286
|
else {
|
|
285
287
|
throw err;
|
|
286
288
|
}
|
|
287
|
-
readState();
|
|
288
289
|
}
|
|
290
|
+
readState();
|
|
289
291
|
};
|
|
290
292
|
const refreshSiteInfo = async () => {
|
|
291
293
|
console.warn('@data-fair/lib-vue/session refreshSiteInfo is deprecated');
|
|
@@ -331,8 +333,7 @@ export async function getSession(initOptions) {
|
|
|
331
333
|
// also run an auto-refresh loop
|
|
332
334
|
if (!ssr && !inIframe && !('triggerCapture' in window)) {
|
|
333
335
|
const lastKeepalive = window.localStorage.getItem('sd-keepalive' + options.sitePath);
|
|
334
|
-
|
|
335
|
-
if (cookies.get('id_token') && (!lastKeepalive || (new Date().getTime() - Number(lastKeepalive)) > 10000)) {
|
|
336
|
+
if (!lastKeepalive || (new Date().getTime() - Number(lastKeepalive)) > 10000) {
|
|
336
337
|
await keepalive();
|
|
337
338
|
}
|
|
338
339
|
const refreshLoopDelay = 10 * 60 * 1000; // 10 minutes
|