Merge pull request 'hotfix: #7323 catch mail err' (!1225) from hotfix-7323-catchMailErr into master
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1225
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Jorge Penadés 2025-01-16 08:38:06 +00:00
commit 6ca732986d
1 changed files with 14 additions and 13 deletions

View File

@ -283,21 +283,22 @@ const fetchWeekData = async () => {
year: selectedDateYear.value,
week: selectedWeekNumber.value,
};
const mail = (
await axiosNoError.get(`Workers/${route.params.id}/mail`, {
params: { filter: { where } },
})
).data[0];
try {
const [{ data: mailData }, { data: countData }] = await Promise.all([
axiosNoError.get(`Workers/${route.params.id}/mail`, {
params: { filter: { where } },
}),
axiosNoError.get('WorkerTimeControlMails/count', { params: { where } }),
]);
if (!mail) state.value = null;
else {
state.value = mail.state;
reason.value = mail.reason;
const mail = mailData[0];
state.value = mail?.state;
reason.value = mail?.reason;
canResend.value = !!countData.count;
} catch {
state.value = null;
}
canResend.value = !!(
await axiosNoError.get('WorkerTimeControlMails/count', { params: { where } })
).data.count;
};
const setHours = (data) => {