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