aboutsummaryrefslogtreecommitdiffstats
path: root/web/middleware/logged-in.ts
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
committerLeonardo Bishop <me@leonardobishop.com>2025-08-23 22:29:28 +0100
commitecc6a55aba7bb35fc778e7a53848396b88214151 (patch)
tree1b37a2dc5f4594155114da1ae0c4529d20a4c548 /web/middleware/logged-in.ts
parent8f7dec8ba6b2f9bde01afd0a110596ebbd43e0ed (diff)
Add multiple conferences feature
Diffstat (limited to 'web/middleware/logged-in.ts')
-rw-r--r--web/middleware/logged-in.ts19
1 files changed, 3 insertions, 16 deletions
diff --git a/web/middleware/logged-in.ts b/web/middleware/logged-in.ts
index 1ddd3ce..97db606 100644
--- a/web/middleware/logged-in.ts
+++ b/web/middleware/logged-in.ts
@@ -1,21 +1,8 @@
+const authStore = useAuthStore()
+
export default defineNuxtRouteMiddleware((to, from) => {
- if ("" === getCookie("fosdem_planner_session")) {
+ if (!authStore.isLoggedIn()) {
return navigateTo("/login");
}
});
-function getCookie(cname: string) {
- let name = cname + "=";
- let decodedCookie = decodeURIComponent(document.cookie);
- let ca = decodedCookie.split(";");
- for (let i = 0; i < ca.length; i++) {
- let c = ca[i];
- while (c.charAt(0) == " ") {
- c = c.substring(1);
- }
- if (c.indexOf(name) == 0) {
- return c.substring(name.length, c.length);
- }
- }
- return "";
-}