Skip to content

Commit

Permalink
fix(applicant): fix auth state to auto apply
Browse files Browse the repository at this point in the history
  • Loading branch information
amandesai01 committed Sep 10, 2024
1 parent fbfba03 commit 6331318
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/pages/postings/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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',
Expand Down

0 comments on commit 6331318

Please sign in to comment.