refs #5835 refactor upsert
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2023-11-22 15:22:25 +01:00
parent 9388b873c6
commit dfddde1d5c
1 changed files with 6 additions and 13 deletions

View File

@ -102,23 +102,16 @@ async function upsert() {
formData.append(dms.value.files[i].name, dms.value.files[i]);
dms.value.hasFileAttached = true;
}
const url = !isEdit ? 'Dms/uploadFile' : `dms/${dms.value.id}/updateFile`;
const { data } = await axios.post(url, formData, {
params: dms.value,
});
if (data.length) invoiceIn.value.dmsFk = data[0].id;
if (!isEdit) {
const { data } = await axios.post('Dms/uploadFile', formData, {
params: dms.value,
});
if (data.length) invoiceIn.value.dmsFk = data[0].id;
createDmsRef.value.hide();
} else if (isEdit) {
const { data } = await axios.post(
`dms/${dms.value.id}/updateFile`,
formData,
{
params: dms.value,
}
);
if (data.length) invoiceIn.value.dmsFk = data[0].id;
editDmsRef.value.hide();
}