diff --git a/src/components/ui/CardList.vue b/src/components/ui/CardList.vue index b8d5c6c6..cd3b0767 100644 --- a/src/components/ui/CardList.vue +++ b/src/components/ui/CardList.vue @@ -1,7 +1,7 @@ @@ -90,8 +100,8 @@ onMounted(() => fetchLanguagesSql()); +import { onMounted, inject, ref } from 'vue'; +import { useRoute } from 'vue-router'; + +import CardList from 'src/components/ui/CardList.vue'; + +import { formatDateTitle } from 'src/lib/filters.js'; + +const jApi = inject('jApi'); + +const route = useRoute(); + +const accessLogs = ref([]); +const user = ref(null); + +const getUser = async () => { + try { + if (!route.params.id) return; + const [data] = await jApi.query( + `SELECT u.id, u.name user, u.nickname, u.email, c.phone, r.name role + FROM account.user u + JOIN account.role r ON r.id = u.role + LEFT JOIN vn.client c ON c.id = u.id + WHERE u.id = #user`, + { user: route.params.id } + ); + user.value = data; + } catch (error) { + console.error('Error getting user:', error); + } +}; + +const getAccessLogs = async () => { + try { + accessLogs.value = await jApi.query( + `SELECT u.stamp, a.platform, a.browser, a.version, a.javascript, a.cookies + FROM visitUser u + JOIN visitAccess c ON c.id = u.accessFk + JOIN visitAgent a ON a.id = c.agentFk + WHERE u.userFk = #user + ORDER BY u.stamp DESC + LIMIT 8`, + { user: route.params.id } + ); + } catch (error) { + console.error('Error getting access logs:', error); + } +}; + +onMounted(async () => { + getUser(); + getAccessLogs(); +}); + + + diff --git a/src/pages/Admin/ConnectionsView.vue b/src/pages/Admin/ConnectionsView.vue index befdfeb5..eec50614 100644 --- a/src/pages/Admin/ConnectionsView.vue +++ b/src/pages/Admin/ConnectionsView.vue @@ -91,6 +91,7 @@ onBeforeUnmount(() => clearInterval(intervalId.value)); v-else v-for="(connection, index) in connections" :key="index" + :to="{ name: 'accessLog', params: { id: connection.userId } }" > +
{{ connections }}
diff --git a/src/pages/Admin/NewsView.vue b/src/pages/Admin/NewsView.vue index 6bb812e6..c0f363a3 100644 --- a/src/pages/Admin/NewsView.vue +++ b/src/pages/Admin/NewsView.vue @@ -65,7 +65,7 @@ onMounted(async () => getNews()); {{ t('addNew') }} - + { results.forEach((result, index) => { const fileIndex = filteredFiles[index].index; addedFiles.value[fileIndex].uploadStatus = result.status; + + if (result.status === 'rejected') { + addedFiles.value[fileIndex].errorMessage = t( + result.reason?.response?.data?.data?.message + ); + } }); const allSuccessful = results.every( @@ -122,10 +141,10 @@ onMounted(async () => getImageCollections());