From a5020be14569a7b5ec14e68cd84c00f6c3440910 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Wed, 27 Mar 2024 22:07:49 +0100 Subject: [PATCH] conditional redirect for Dokumente --- src/routes/(main)/+page.svelte | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/routes/(main)/+page.svelte b/src/routes/(main)/+page.svelte index 9c43873..35ea4ec 100644 --- a/src/routes/(main)/+page.svelte +++ b/src/routes/(main)/+page.svelte @@ -3,6 +3,23 @@ import LinksGrid from "$lib/components/LinksGrid.svelte"; export let data; import { page } from "$app/stores" + + const redirect_to_docs = () => { + console.log(data.session.user.groups); + if (!data.session){ + alert("Du musst dich einloggen, um diese Seite zu betreten."); + window.location.href = "/auth/signin"; + + } + else if (data.session.user.groups.includes("paperless_users")){ + window.location.href = "https://docs.bocken.org"; + } + else if (data.session.user.groups.includes("paperless_eltern_users")){ + window.location.href = "https://dokumente.bocken.org"; + } + else + alert("Du hast keine Berechtigung, diese Seite zu betreten."); + }