This commit is contained in:
Viet An
2026-04-07 14:04:46 +07:00
parent d17a9e2588
commit bcfda00993
8 changed files with 86 additions and 20 deletions

View File

@@ -1,9 +1,12 @@
<template>
<div style="min-height: 100vh" class="has-background-white" data-theme="light" lang="vi" v-if="authorized">
<slot />
<div
style="min-height: 100vh"
class="has-background-white"
data-theme="light"
lang="vi"
>
<slot></slot>
<SnackBar v-if="snackbar" v-bind="snackbar" @close="$store.removeSnackbar()" />
<Modal v-if="showmodal" v-bind="showmodal" @close="showmodal = undefined" />
</div>
</template>
@@ -39,12 +42,12 @@ async function checkRedirect() {
},
true
);
if (row === "error" || row === undefined) $requestLogin();
if (row === "error" || row === undefined) return; /* $requestLogin(); */
else {
row.token = route.query.token;
$store.commit("login", row);
}
} else if (!$store.login) return $requestLogin();
} else if (!$store.login) return /* $requestLogin(); */
await checkLogin();
}
async function checkLogin() {
@@ -58,9 +61,10 @@ async function checkLogin() {
true
));
let authtoken = await $getdata("token", { token: $store.login.token }, undefined, true);
if (authtoken ? authtoken.expiry : true) return $requestLogin();
if (authtoken ? authtoken.expiry : true) return /* $requestLogin(); */
authorized.value = true;
} else $requestLogin();
}
// else $requestLogin();
}
onMounted(() => {
checkRedirect()