Skip to content

Commit

Permalink
fix(apply): login state issue
Browse files Browse the repository at this point in the history
  • Loading branch information
amandesai01 committed Oct 23, 2024
1 parent d11845c commit 07dbe80
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions app/pages/postings/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ const apply = async () => {
return;
}
try {
if (!isSignedIn.value) {
await redirectToLogin(route.fullPath);
return;
}
isApplying.value = true;
await $fetch('/api/application', {
method: 'POST',
Expand All @@ -46,13 +42,18 @@ const apply = async () => {
}
};
if (route.query.fromOnboard) {
watch(status, (s) => {
if (s == 'success' && (!applicationStatus.value || !applicationStatus.value.userAlreadyApplied)) {
apply();
onMounted(async () => {
if (route.query.fromOnboard) {
if (!isSignedIn.value) {
await redirectToLogin(route.fullPath);
}
});
}
watch(status, (s) => {
if (s == 'success' && (!applicationStatus.value || !applicationStatus.value.userAlreadyApplied)) {
apply();
}
});
}
});
</script>

<template>
Expand Down

0 comments on commit 07dbe80

Please sign in to comment.