refactor: improve code formatting and consistency in auth and login components

This commit is contained in:
ArielLeyva 2025-09-18 15:00:11 -04:00
parent 03664c61ba
commit 4feba703f7
3 changed files with 12 additions and 11 deletions

View File

@ -24,7 +24,7 @@ export function parseToken(token: string) {
const expiresAt = new Date(data.exp! * 1000);
authStore.setLogoutTimer(
window.setTimeout(() => {
logout('inactivity');
logout("inactivity");
}, expiresAt.getTime() - Date.now())
);
}
@ -113,16 +113,15 @@ export function logout(reason?: string) {
if (noAuth) {
window.location.reload();
} else {
if(typeof reason === "string" && reason.trim() !== "") {
if (typeof reason === "string" && reason.trim() !== "") {
router.push({
path: "/login",
query: { "logout-reason": reason }
query: { "logout-reason": reason },
});
} else {
router.push({
path: "/login",
});
}
}
}

View File

@ -3,7 +3,9 @@
<form @submit="submit">
<img :src="logoURL" alt="File Browser" />
<h1>{{ name }}</h1>
<p v-if="reason != null" class="logout-message">{{t(`login.logout_reasons.${reason}`)}}</p>
<p v-if="reason != null" class="logout-message">
{{ t(`login.logout_reasons.${reason}`) }}
</p>
<div v-if="error !== ''" class="wrong">{{ error }}</div>
<input
@ -71,7 +73,7 @@ const toggleMode = () => (createMode.value = !createMode.value);
const $showError = inject<IToastError>("$showError")!;
const reason = route.query['logout-reason'] ?? null;
const reason = route.query["logout-reason"] ?? null;
const submit = async (event: Event) => {
event.preventDefault();