From 8665524d167063cd817c93ea193bd0e9ca67f70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A4ssin=20Aouani?= Date: Tue, 12 Nov 2024 12:52:39 +0100 Subject: [PATCH] try to fix login prompt --- app.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app.vue b/app.vue index e072f6b..3d72421 100644 --- a/app.vue +++ b/app.vue @@ -37,8 +37,13 @@ const username = useCookie("username") const password = useCookie("password") const isLoggedIn = useState("isLoggedIn", (() => false)) -const test_url = `https://corsproxy.io/?https%3A%2F%2Fselfservice.campus-dual.de%2Fdash%2Fgetcp%3Fuser%3D${username.value}%26hash%3D${password.value}` -const response = await $fetch(test_url) - -isLoggedIn.value = !!(response == 0) +onMounted(async () => { + try { + const test_url = `https://corsproxy.io/?https%3A%2F%2Fselfservice.campus-dual.de%2Fdash%2Fgetcp%3Fuser%3D${username.value}%26hash%3D${password.value}` + const response = await $fetch(test_url) + isLoggedIn.value = !!(response == 0) + } catch (error) { + isLoggedIn.value = false + } +})