updated kpi & check token
This commit is contained in:
parent
4d8acb49a3
commit
c7d672aeda
8 changed files with 110 additions and 35 deletions
|
|
@ -6,6 +6,7 @@ import { useRoute, useRouter } from "vue-router";
|
|||
import { useQuasar } from "quasar";
|
||||
import keycloak, { kcLogout } from "@/plugins/keycloak";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import CustomComponent from "@/components/CustomDialog.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
|
@ -35,11 +36,33 @@ const link = ref<string>("");
|
|||
*/
|
||||
onMounted(async () => {
|
||||
await fetchTotolNotificate();
|
||||
checkUser();
|
||||
if (keycloak.tokenParsed != null) {
|
||||
fullname.value = keycloak.tokenParsed.name;
|
||||
}
|
||||
});
|
||||
|
||||
async function checkUser() {
|
||||
http.get(config.API.profilePosition()).catch((err) => {
|
||||
$q.dialog({
|
||||
component: CustomComponent,
|
||||
componentProps: {
|
||||
title: "ข้อความแจ้งเตือน",
|
||||
message: err.response.data.message,
|
||||
icon: "warning",
|
||||
color: "red",
|
||||
onlycancel: true,
|
||||
},
|
||||
}).onCancel(async () => {
|
||||
showLoader();
|
||||
await kcLogout();
|
||||
setTimeout(() => {
|
||||
hideLoader();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const totalNoti = ref<number>(0);
|
||||
async function fetchTotolNotificate() {
|
||||
await http
|
||||
|
|
@ -107,7 +130,7 @@ const clickDelete = async (id: string, index: number) => {
|
|||
.delete(config.API.msgId(id))
|
||||
.then(() => {
|
||||
notiList.value.splice(index, 1);
|
||||
totalInbox.value--;
|
||||
totalNoti.value--;
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -174,6 +197,7 @@ function onInfo() {
|
|||
router.push(`/retire`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- โครงเว็บ -->
|
||||
<template>
|
||||
<q-layout view="hHh LpR fFr">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue