perf: refs #8217 changes
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Javier Segarra 2025-04-30 11:43:05 +02:00
parent 0199557463
commit 23d1791193
1 changed files with 3 additions and 4 deletions

View File

@ -149,7 +149,6 @@ const submitForm = async (evt) => {
await save(evt); await save(evt);
} }
}; };
const mapper = toRef($props, 'mapper');
onMounted(async () => { onMounted(async () => {
nextTick(() => (componentIsRendered.value = true)); nextTick(() => (componentIsRendered.value = true));
@ -234,7 +233,7 @@ async function fetch() {
} }
async function handleResponse(promise) { async function handleResponse(promise) {
const response = await Promise.allSettled([promise]); const [response] = await Promise.all([promise]);
updateAndEmit('onDataSaved', { updateAndEmit('onDataSaved', {
val: formData.value, val: formData.value,
res: response?.data, res: response?.data,
@ -254,8 +253,8 @@ async function create() {
} }
async function update() { async function update() {
const body = mapper.value const body = $props.mapper
? mapper.value(originalData.value, formData.value) ? $props.mapper(originalData.value, formData.value)
: formData.value; : formData.value;
const url = $props.urlUpdate || $props.url || arrayData.store.url; const url = $props.urlUpdate || $props.url || arrayData.store.url;
const promise = $props.saveFn ? $props.saveFn(body) : axios.patch(url, body); const promise = $props.saveFn ? $props.saveFn(body) : axios.patch(url, body);