mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-07-22 13:33:39 -04:00
fix: make sure $settingsPub is not undefined #242
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
}
|
||||
|
||||
// redirect to welcome page if setup is not completed
|
||||
if (!$settingsPub.setup_completed && $page.url.pathname !== '/welcome') {
|
||||
if ($settingsPub.setup_completed === false && $page.url.pathname !== '/welcome') {
|
||||
goto('/welcome');
|
||||
return;
|
||||
}
|
||||
@@ -81,17 +81,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if ($pocketbase.authStore.model?.collectionName === 'users') {
|
||||
if ($pocketbase.authStore.isAdmin) {
|
||||
await $pocketbase.admins.authRefresh().catch(() => {
|
||||
goto('/login');
|
||||
});
|
||||
} else {
|
||||
await $pocketbase
|
||||
.collection('users')
|
||||
.authRefresh()
|
||||
.catch(() => {
|
||||
goto('/login');
|
||||
});
|
||||
} else {
|
||||
await $pocketbase.admins.authRefresh().catch(() => {
|
||||
goto('/login');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
if (!$settingsPub.setup_completed && $pocketbase.authStore.isValid) {
|
||||
if ($settingsPub && $settingsPub.setup_completed === false && $pocketbase.authStore.isValid) {
|
||||
$pocketbase.authStore.clear();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user