mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-08-04 19:25:13 -04:00
fix: only clear auth on 401 or 403, close #1158
This commit is contained in:
@@ -59,17 +59,27 @@
|
||||
await $pocketbase
|
||||
.collection('_superusers')
|
||||
.authRefresh()
|
||||
.catch(() => {
|
||||
$pocketbase.authStore.clear();
|
||||
goto('/login');
|
||||
.catch((err) => {
|
||||
// clear the store only on invalidated/expired token
|
||||
const status = err?.status << 0;
|
||||
if (status == 401 || status == 403) {
|
||||
$pocketbase.authStore.clear();
|
||||
goto('/login');
|
||||
} else {
|
||||
console.log('NOT CLEARED');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await $pocketbase
|
||||
.collection('users')
|
||||
.authRefresh()
|
||||
.catch(() => {
|
||||
$pocketbase.authStore.clear();
|
||||
goto('/login');
|
||||
.catch((err) => {
|
||||
// clear the store only on invalidated/expired token
|
||||
const status = err?.status << 0;
|
||||
if (status == 401 || status == 403) {
|
||||
$pocketbase.authStore.clear();
|
||||
goto('/login');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user