From 63313189db8d0bbc2eecd0279c8feb40c0edbf58 Mon Sep 17 00:00:00 2001 From: amandesai01 Date: Tue, 10 Sep 2024 20:36:30 +0530 Subject: [PATCH] fix(applicant): fix auth state to auto apply --- app/pages/postings/[id].vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/pages/postings/[id].vue b/app/pages/postings/[id].vue index f31bc68..ab7427f 100644 --- a/app/pages/postings/[id].vue +++ b/app/pages/postings/[id].vue @@ -2,6 +2,9 @@ const route = useRoute(); const id = route.params.id as string; +const { isSignedIn } = useAuth(); +const { redirectToLogin } = useSafeRedirectToLogin(); + const { data: applicationStatus, refresh: refreshApplicationStatus } = useApplicationStatus(id); const { data: posting } = await usePublicPostingRepository({ id }); @@ -26,6 +29,10 @@ const apply = async () => { return; } try { + if (!isSignedIn.value) { + await redirectToLogin(route.fullPath); + return; + } isApplying.value = true; await $fetch('/api/application', { method: 'POST',