fix: message error to reject proposal

This commit is contained in:
Alexandro Uc Santos
2025-07-26 19:38:09 -06:00
parent ba630fb1de
commit c600671934
3 changed files with 18 additions and 14 deletions

View File

@@ -57,6 +57,6 @@ export const updateProposal = async(id, formData) => {
const {data} = await api.patch(endpoint, formData);
return data;
} catch (error) {
return null;
throw error;
}
}

View File

@@ -191,17 +191,21 @@ export const useCompanyStore = defineStore('company', () => {
}
const updatePropsalLoad = async(id, formData, localData) => {
const data = await updateProposal(id, formData);
if(data) {
const index = proposals.value.findIndex((prop) => prop._id === id);
proposals.value[index] = {
...proposals.value[index],
...data,
...localData
};
return 'success';
} else {
return t('errors.generic');
try {
const data = await updateProposal(id, formData);
if(data) {
const index = proposals.value.findIndex((prop) => prop._id === id);
proposals.value[index] = {
...proposals.value[index],
...data,
...localData
};
return 'success';
} else {
return t('errors.generic');
}
} catch (error) {
return error.response?.data?.error ?? t('errors.generic');
}
}

View File

@@ -54,7 +54,7 @@
Swal.close();
if(resp != null) {
if(resp === 'success') {
Swal.fire({
title: t('proposals.msgTitleRetire'),
text: t('proposals.msgCancel'),
@@ -63,7 +63,7 @@
} else {
Swal.fire({
title: "Error",
text: t('proposals.msgNotCancel'),
text: resp,
icon: "error"
});
}