From 554c09155fd9b10bd14caaec5e2ecffdc63ed96d Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 26 Apr 2023 12:04:55 +0200 Subject: [PATCH 1/3] refs #5255 --- src/components/UserPanel.vue | 2 +- src/composables/useRole.js | 2 +- src/pages/Ticket/Card/TicketBoxing.vue | 221 +++++++++--------- .../pages/Tickets/TicketBoxing.spec.js | 2 +- 4 files changed, 113 insertions(+), 114 deletions(-) diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue index 6bc00d5ce..a7504705a 100644 --- a/src/components/UserPanel.vue +++ b/src/components/UserPanel.vue @@ -70,7 +70,7 @@ async function saveDarkMode(value) { } async function saveLanguage(value) { - const query = `/Accounts/${user.value.id}`; + const query = `/VnUsers/${user.value.id}`; await axios.patch(query, { lang: value, }); diff --git a/src/composables/useRole.js b/src/composables/useRole.js index b8da153d3..a781785a0 100644 --- a/src/composables/useRole.js +++ b/src/composables/useRole.js @@ -5,7 +5,7 @@ export function useRole() { const state = useState(); async function fetch() { - const { data } = await axios.get('Accounts/acl'); + const { data } = await axios.get('VnUsers/acl'); const roles = data.roles.map((userRoles) => userRoles.role.name); const userData = { diff --git a/src/pages/Ticket/Card/TicketBoxing.vue b/src/pages/Ticket/Card/TicketBoxing.vue index 9d46ddba2..a398d82c9 100644 --- a/src/pages/Ticket/Card/TicketBoxing.vue +++ b/src/pages/Ticket/Card/TicketBoxing.vue @@ -27,16 +27,20 @@ const time = ref({ }); async function fetch() { - const filter = { - where: { - ticketFk: entityId.value, - }, - }; - const { data } = await axios.get(`/Expeditions/filter`, { - params: { filter }, - }); + try { + const filter = { + where: { + ticketFk: entityId.value, + }, + }; + const { data } = await axios.get(`/Expeditions/filter`, { + params: { filter }, + }); - if (data) expeditions.value = data; + if (data) expeditions.value = data; + } catch (e) { + // + } } async function getVideoList(expeditionId, timed) { @@ -46,115 +50,110 @@ async function getVideoList(expeditionId, timed) { }; if (timed) { + if (timed.max == timed.min) { + if (timed.max != 24) timed.max += 1; + else timed.min -= 1; + } Object.assign(params, { from: timed.min, to: timed.max }); } - const { data } = await axios.get(`/Boxings/getVideoList`, { params: params }); + await axios.get(`/Boxings/getVideoList`, { params: params }).then((res) => { + const data = res.data; + if (!data.length) { + return quasar.notify({ + message: t('ticket.boxing.notFound'), + type: 'negative', + }); + } + const list = []; + for (const video of data) { + const videoName = video.split('.')[0].split('T')[1].replace(/-/g, ':'); + list.push({ + label: videoName, + value: video, + url: `api/Boxings/getVideo?id=${expeditionId}&filename=${video}`, + }); + } - const list = []; - for (const video of data) { - const videName = video.split('.')[0].split('T')[1].replaceAll('-', ':'); - list.push({ - label: videName, - value: video, - url: `api/Boxings/getVideo?id=${expeditionId}&filename=${video}`, - }); - } - - videoList.value = list.reverse(); - if (list[0]) { - slide.value = list[0].value; - time.value = { - min: parseInt(list[0].label.split(':')[0]), - max: parseInt(list[list.length - 1].label.split(':')[0]), - }; - } - - if (!data.length) { - return quasar.notify({ - message: t('ticket.boxing.notFound'), - type: 'negative', - }); - } + videoList.value = list.reverse(); + if (list[0]) { + slide.value = list[0].value; + time.value = { + min: parseInt(list[0].label.split(':')[0]), + max: parseInt(list[list.length - 1].label.split(':')[0]) + 1, + }; + } + }); }