mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
401 reauth experiments
This commit is contained in:
@@ -25,15 +25,16 @@ export function SessionAutoRefresh({ children }) {
|
||||
const interval = setInterval(() => {
|
||||
if (accessTokenExpires !== null) {
|
||||
const timeLeft = accessTokenExpires - Date.now();
|
||||
if (timeLeft < REFRESH_BEFORE) {
|
||||
auth
|
||||
.update()
|
||||
.then(() => {})
|
||||
.catch((e) => {
|
||||
// note: 401 won't be considered error here
|
||||
console.error("error refreshing auth token", e);
|
||||
});
|
||||
}
|
||||
console.log("time left", timeLeft);
|
||||
// if (timeLeft < REFRESH_BEFORE) {
|
||||
// auth
|
||||
// .update()
|
||||
// .then(() => {})
|
||||
// .catch((e) => {
|
||||
// // note: 401 won't be considered error here
|
||||
// console.error("error refreshing auth token", e);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}, INTERVAL_REFRESH_MS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user