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) { if (res.ok) {
return res.json(); return;
} else { } 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) { if (res.ok) {
const out = res.json(); const out = res.json();
console.log(out);
if (!out) { if (!out) {
return null; return null;
} }

View File

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

View File

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