diff --git a/app.vue b/app.vue index 3d72421..16af81a 100644 --- a/app.vue +++ b/app.vue @@ -1,7 +1,8 @@ @@ -15,24 +16,6 @@ useHead }], }) -const links = [ - { - label: "Home", - icon: "i-heroicons-home", - to: "/", - }, - { - label: "Stundenplan", - icon: "i-heroicons-clock", - to: "/stundenplan", - }, - { - label: "Wie finde ich mein Passwort (Hash)?", - icon: "i-heroicons-document-text", - to: "/hash", - }, -]; - const username = useCookie("username") const password = useCookie("password") const isLoggedIn = useState("isLoggedIn", (() => false)) diff --git a/layouts/dash.vue b/layouts/dash.vue new file mode 100644 index 0000000..bb0e41a --- /dev/null +++ b/layouts/dash.vue @@ -0,0 +1,22 @@ + diff --git a/layouts/default.vue b/layouts/default.vue new file mode 100644 index 0000000..2dfe9ad --- /dev/null +++ b/layouts/default.vue @@ -0,0 +1,22 @@ + diff --git a/middleware/isLoggedIn.global.ts b/middleware/isLoggedIn.global.ts index e09ccb8..37b7a56 100644 --- a/middleware/isLoggedIn.global.ts +++ b/middleware/isLoggedIn.global.ts @@ -1,11 +1,19 @@ export default defineNuxtRouteMiddleware(async (to, from) => { if (import.meta.server) return true - if (to.fullPath !== "/stundenplan") { + + const isLoggedIn = useState("isLoggedIn", (() => false) as () => boolean) + + if (["/", "/hash", "/login"].includes(to.fullPath)) { + if (isLoggedIn.value) { + return navigateTo("/dash") + } + } + + if (!to.fullPath.includes("dash")) { return true } const username = useCookie("username") const password = useCookie("password") - const isLoggedIn = useState("isLoggedIn", (() => false) as () => boolean) if (!isLoggedIn.value) { try { diff --git a/pages/dash/index.vue b/pages/dash/index.vue new file mode 100644 index 0000000..fa70998 --- /dev/null +++ b/pages/dash/index.vue @@ -0,0 +1,15 @@ + + + \ No newline at end of file diff --git a/pages/stundenplan.vue b/pages/dash/stundenplan.vue similarity index 94% rename from pages/stundenplan.vue rename to pages/dash/stundenplan.vue index 98e14c7..2ee90ca 100644 --- a/pages/stundenplan.vue +++ b/pages/dash/stundenplan.vue @@ -32,18 +32,15 @@ - - diff --git a/pages/index.vue b/pages/index.vue index 9a7b802..d796415 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -13,11 +13,9 @@

Zum Github-Repo:

- probablyjassin/stundenplancampusdual + probablyjassin/stundenplancampusdual
- - \ No newline at end of file diff --git a/pages/login.vue b/pages/login.vue index 4a79370..509e0ef 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -12,69 +12,63 @@
- +

Bitte geben Sie einen Benutzernamen ein.

- +

Bitte geben Sie ein Passwort ein.

- -

Der Login ist fehlgeschlagen. Überprüfe ob du tatsächlich deinen aktuellen Hash von der CampusDual API hast.

+ Login +

Der Login ist fehlgeschlagen. Überprüfe ob du tatsächlich deinen + aktuellen Hash von der CampusDual API hast.

diff --git a/pages/logout.vue b/pages/logout.vue new file mode 100644 index 0000000..798deac --- /dev/null +++ b/pages/logout.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file