Initial commit

This commit is contained in:
2024-12-29 12:11:11 +01:00
parent 6e1e00d048
commit 856dfbd119
9 changed files with 105 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
const validPaths = ["/", "/rules", "/test"];
export default defineNuxtRouteMiddleware(async (to, from) => {
const config = useRuntimeConfig();
if (to.path == "/login") {
console.log("hey")
const code = to.query.code;
if (!code) {
navigateTo(config.public.discordLoginEndpoint, { external: true });
} else {
navigateTo("/login");
}
return
}
if (validPaths.includes(to.path)) {
return;
}
if (to.path !== "/") {
return navigateTo("/");
}
});