fixing check token

This commit is contained in:
Warunee Tamkoo 2024-07-26 10:19:35 +07:00
parent 8d51e6f623
commit f6b2b26998
5 changed files with 33 additions and 21 deletions

View file

@ -4,7 +4,7 @@ import config from "@/app.config";
import { onMounted, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
import keycloak from "@/plugins/keycloak";
import keycloak, { kcLogout } from "@/plugins/keycloak";
import { useCounterMixin } from "@/stores/mixin";
const route = useRoute();
@ -93,20 +93,13 @@ const doLogout = () => {
$q,
async () => {
// authen with keycloak client
keycloak.logout();
await deleteCookie("BMAHRIS_KEYCLOAK_IDENTITY");
await deleteCookie("BMAHRIS_KEYCLOAK_REFRESH");
window.location.href = "/login";
kcLogout();
},
"ยืนยันการออกจากระบบ",
"ต้องการออกจากระบบใช่หรือไม่"
);
};
function deleteCookie(name: string) {
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
}
const clickDelete = async (id: string, index: number) => {
dialogRemove($q, async () => {
// showLoader();
@ -458,19 +451,29 @@ function onInfo() {
><q-item-label>ขอลาออก</q-item-label></q-item-section
>
</q-item>
<q-item clickable v-close-popup>
<q-item-section avatar style="min-width: 30px">
<q-icon color="orange-9" size="18px" name="mdi-lock-outline" />
<q-icon
color="orange-9"
size="18px"
name="mdi-lock-outline"
/>
</q-item-section>
<q-item-section
><q-item-label>เปลยนรหสผาน</q-item-label></q-item-section
><q-item-label
>เปลยนรหสผาน</q-item-label
></q-item-section
>
</q-item>
<q-item clickable v-close-popup @click="doLogout">
<q-item-section avatar style="min-width: 30px">
<q-icon color="primary" size="18px" name="mdi-logout-variant" />
<q-icon
color="primary"
size="18px"
name="mdi-logout-variant"
/>
</q-item-section>
<q-item-section>
<q-item-label>ออกจากระบบ</q-item-label>