Fixed type check.
Build and Deploy Web App / build-and-deploy (push) Successful in 19s Details

This commit is contained in:
andrewlalis 2025-09-21 11:31:44 -04:00
parent 33f8119ee3
commit bbe3e2aab5
1 changed files with 7 additions and 20 deletions

View File

@ -31,9 +31,10 @@ function canSave() {
const inputValid = name.value.trim().length > 0 const inputValid = name.value.trim().length > 0
if (!inputValid) return false if (!inputValid) return false
if (props.vendor) { if (props.vendor) {
const newDesc = description.value.trim().length === 0 ? null : description.value.trim()
return ( return (
props.vendor.name.trim() !== name.value.trim() || props.vendor.name.trim() !== name.value.trim() ||
props.vendor.description.trim() !== description.value.trim() props.vendor.description !== newDesc
) )
} }
return true return true
@ -43,7 +44,7 @@ async function doSave() {
const api = new TransactionApiClient(getSelectedProfile(route)) const api = new TransactionApiClient(getSelectedProfile(route))
const payload = { const payload = {
name: name.value.trim(), name: name.value.trim(),
description: description.value.trim(), description: description.value.trim().length === 0 ? null : description.value.trim(),
} }
try { try {
let savedVendor = null let savedVendor = null
@ -69,31 +70,17 @@ defineExpose({ show })
<AppForm> <AppForm>
<FormGroup> <FormGroup>
<FormControl label="Name"> <FormControl label="Name">
<input <input type="text" v-model="name" />
type="text"
v-model="name"
/>
</FormControl> </FormControl>
<FormControl <FormControl label="Description" style="min-width: 300px">
label="Description"
style="min-width: 300px"
>
<textarea v-model="description"></textarea> <textarea v-model="description"></textarea>
</FormControl> </FormControl>
</FormGroup> </FormGroup>
</AppForm> </AppForm>
</template> </template>
<template v-slot:buttons> <template v-slot:buttons>
<AppButton <AppButton :disabled="!canSave()" @click="doSave()">Save</AppButton>
:disabled="!canSave()" <AppButton button-style="secondary" @click="modal?.close()">Cancel</AppButton>
@click="doSave()"
>Save</AppButton
>
<AppButton
button-style="secondary"
@click="modal?.close()"
>Cancel</AppButton
>
</template> </template>
</ModalWrapper> </ModalWrapper>
</template> </template>