fixed an issue with a bad response on submitting LOA

This commit is contained in:
2025-12-11 20:37:00 -05:00
parent 710b24e5a7
commit f0ac2dca02
3 changed files with 23 additions and 19 deletions

View File

@@ -13,9 +13,9 @@ export async function submitLOA(request: LOARequest): Promise<{ id?: number; err
});
if (res.ok) {
return res.json();
return;
} else {
return { error: "Failed to submit LOA" };
throw new Error("Failed to submit LOA");
}
}
@@ -113,7 +113,6 @@ export async function getLoaPolicy(): Promise<string> {
});
if (res.ok) {
const out = res.json();
console.log(out);
if (!out) {
return null;
}

View File

@@ -58,11 +58,13 @@ const df = new Intl.DateTimeFormat('en-US', {
day: 'numeric'
});
const userStore = useUserStore()
//form stuff
import { loaSchema } from '@shared/schemas/loaSchema'
import { toTypedSchema } from "@vee-validate/zod";
import Calendar from "../ui/calendar/Calendar.vue";
import { useUserStore } from "@/stores/user";
const { handleSubmit, values, resetForm } = useForm({
validationSchema: toTypedSchema(loaSchema),
@@ -81,6 +83,7 @@ const onSubmit = handleSubmit(async (values) => {
await adminSubmitLOA(out);
} else {
await submitLOA(out);
userStore.loadUser();
}
})

View File

@@ -17,22 +17,24 @@ const showLOADialog = ref(false);
</script>
<template>
<Dialog v-model:open="showLOADialog" v-on:update:open="showLOADialog = false">
<DialogContent class="sm:max-w-fit">
<DialogHeader>
<DialogTitle>Post LOA</DialogTitle>
<DialogDescription>
Post an LOA on behalf of a member.
</DialogDescription>
</DialogHeader>
<LoaForm :admin-mode="true" class="my-3"></LoaForm>
</DialogContent>
</Dialog>
<div class="max-w-5xl mx-auto pt-10">
<div class="flex justify-end mb-4">
<Button @click="showLOADialog = true">Post LOA</Button>
<div>
<Dialog v-model:open="showLOADialog" v-on:update:open="showLOADialog = false">
<DialogContent class="sm:max-w-fit">
<DialogHeader>
<DialogTitle>Post LOA</DialogTitle>
<DialogDescription>
Post an LOA on behalf of a member.
</DialogDescription>
</DialogHeader>
<LoaForm :admin-mode="true" class="my-3"></LoaForm>
</DialogContent>
</Dialog>
<div class="max-w-5xl mx-auto pt-10">
<div class="flex justify-end mb-4">
<Button @click="showLOADialog = true">Post LOA</Button>
</div>
<h1>LOA Log</h1>
<LoaList :admin-mode="true"></LoaList>
</div>
<h1>LOA Log</h1>
<LoaList :admin-mode="true"></LoaList>
</div>
</template>