Logout if there is no token

This commit is contained in:
marzban-dev
2025-01-16 16:03:12 +03:30
parent c5ba268e0a
commit 458025edb4
+6 -3
View File
@@ -1,9 +1,12 @@
export default defineNuxtRouteMiddleware(() => {
const { token } = useAuth();
import { useAuth } from "~/composables/api/auth/useAuth";
if (token.value) {
export default defineNuxtRouteMiddleware(() => {
const { token, logout } = useAuth();
if (!!token.value) {
return;
} else {
logout();
return navigateTo("/signin");
}
});