This commit is contained in:
parent
0199557463
commit
23d1791193
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue