diff --git a/ui/src/components/loa/loaForm.vue b/ui/src/components/loa/loaForm.vue index c6f71c2..cfa2077 100644 --- a/ui/src/components/loa/loaForm.vue +++ b/ui/src/components/loa/loaForm.vue @@ -66,14 +66,19 @@ import { loaSchema } from '@shared/schemas/loaSchema' import { toTypedSchema } from "@vee-validate/zod"; import Calendar from "../ui/calendar/Calendar.vue"; import { useUserStore } from "@/stores/user"; +import Spinner from "../ui/spinner/Spinner.vue"; const { handleSubmit, values, resetForm } = useForm({ validationSchema: toTypedSchema(loaSchema), }) const formSubmitted = ref(false); +const submitting = ref(false); const onSubmit = handleSubmit(async (values) => { + //catch double submit + if (submitting.value) return; + submitting.value = true; const out: LOARequest = { member_id: values.member_id, start_date: values.start_date, @@ -88,6 +93,7 @@ const onSubmit = handleSubmit(async (values) => { userStore.loadUser(); } formSubmitted.value = true; + submitting.value = false; }) onMounted(async () => { @@ -325,7 +331,12 @@ const filteredMembers = computed(() => {
- +
diff --git a/ui/src/components/promotions/promotionForm.vue b/ui/src/components/promotions/promotionForm.vue index a6708f6..4e614ce 100644 --- a/ui/src/components/promotions/promotionForm.vue +++ b/ui/src/components/promotions/promotionForm.vue @@ -31,8 +31,12 @@ const { handleSubmit, errors, values, resetForm, setFieldValue, submitCount } = validateOnMount: false, }) +const submitting = ref(false); + const submitForm = handleSubmit( async (vals) => { + if (submitting.value) return; + submitting.value = true; try { let output = vals; output.promotions.map(p => p.start_date = new Date(p.start_date).toISOString()) @@ -42,6 +46,8 @@ const submitForm = handleSubmit( } catch (error) { submitError.value = error; console.error(error); + } finally { + submitting.value = false; } } ); @@ -281,7 +287,12 @@ function setAllToday() {
- +

{{ submitError }}

@@ -94,8 +99,11 @@ async function handleAddMember() { -