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, year: selectedDateYear.value,
week: selectedWeekNumber.value, week: selectedWeekNumber.value,
}; };
const mail = ( try {
await axiosNoError.get(`Workers/${route.params.id}/mail`, { const [{ data: mailData }, { data: countData }] = await Promise.all([
axiosNoError.get(`Workers/${route.params.id}/mail`, {
params: { filter: { where } }, params: { filter: { where } },
}) }),
).data[0]; axiosNoError.get('WorkerTimeControlMails/count', { params: { where } }),
]);
if (!mail) state.value = null; const mail = mailData[0];
else {
state.value = mail.state; state.value = mail?.state;
reason.value = mail.reason; 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) => { const setHours = (data) => {