From 0f64cdbb3b6a7141a13d8fbbaced419c4df10049 Mon Sep 17 00:00:00 2001 From: amandesai01 Date: Thu, 24 Oct 2024 00:20:34 +0530 Subject: [PATCH] fix(apply): defer applying till status received --- app/pages/postings/[id].vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/pages/postings/[id].vue b/app/pages/postings/[id].vue index ab7427f7..879d13b4 100644 --- a/app/pages/postings/[id].vue +++ b/app/pages/postings/[id].vue @@ -5,7 +5,7 @@ const id = route.params.id as string; const { isSignedIn } = useAuth(); const { redirectToLogin } = useSafeRedirectToLogin(); -const { data: applicationStatus, refresh: refreshApplicationStatus } = useApplicationStatus(id); +const { data: applicationStatus, refresh: refreshApplicationStatus, status } = useApplicationStatus(id); const { data: posting } = await usePublicPostingRepository({ id }); const { data: careerSiteConfig } = useCareerSiteConfigObjectState(); @@ -47,7 +47,11 @@ const apply = async () => { }; if (route.query.fromOnboard) { - apply(); + watch(status, (s) => { + if (s == 'success' && (!applicationStatus.value || !applicationStatus.value.userAlreadyApplied)) { + apply(); + } + }); }