Fix : switch to state based shuffle animation
This commit is contained in:
+13
-10
@@ -2,21 +2,23 @@ import { useAuthStore } from "#imports";
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
const authStore = useAuthStore();
|
||||
const config = useRuntimeConfig();
|
||||
if (to.path == "/login") {
|
||||
const code = to.query.code;
|
||||
if (code) {
|
||||
if (!Array.isArray(code)) {
|
||||
try {
|
||||
await authStore.whoami();
|
||||
return navigateTo("/lobby");
|
||||
} catch {
|
||||
return navigateTo("/login");
|
||||
}
|
||||
} else {
|
||||
if (!code) {
|
||||
return navigateTo(config.public.discordLoginEndpoint, { external: true });
|
||||
}
|
||||
|
||||
if (!Array.isArray(code)) {
|
||||
try {
|
||||
await authStore.whoami();
|
||||
return navigateTo("/lobby");
|
||||
} catch {
|
||||
return navigateTo("/login");
|
||||
}
|
||||
} else {
|
||||
return navigateTo("/login");
|
||||
}
|
||||
return navigateTo("/lobby");
|
||||
}
|
||||
|
||||
// if (to.path == '/') {
|
||||
@@ -69,4 +71,5 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
if (to.path !== "/") {
|
||||
return navigateTo("/");
|
||||
}
|
||||
return navigateTo("/lobby");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user