API integration stuff
This commit is contained in:
@@ -16,6 +16,7 @@ import { Form } from 'vee-validate';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import * as z from 'zod';
|
||||
import DateInput from '../form/DateInput.vue';
|
||||
import { ApplicationData } from '@/api/application';
|
||||
|
||||
const formSchema = toTypedSchema(z.object({
|
||||
dob: z.string().refine(v => v, { message: "A date of birth is required." }),
|
||||
@@ -45,7 +46,7 @@ const fallbackInitials = {
|
||||
|
||||
const props = defineProps<{
|
||||
readOnly: boolean,
|
||||
data: object,
|
||||
data: ApplicationData,
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['submit']);
|
||||
@@ -57,8 +58,8 @@ async function onSubmit(val: any) {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (props.data) {
|
||||
initialValues.value = { ...props.data, ...fallbackInitials }
|
||||
if (props.data !== null) {
|
||||
initialValues.value = { ...props.data }
|
||||
} else {
|
||||
initialValues.value = { ...fallbackInitials }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user