diff --git a/src/main.ts b/src/main.ts index df8024dbe..e179635f1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,6 @@ import App from "./App.vue"; import router from "./router"; import { Dialog, Notify, Quasar, Loading } from "quasar"; import "./quasar-user-options"; -import keycloak, { getToken } from "@/plugins/keycloak"; import qDraggableTable from "quasar-ui-q-draggable-table"; import "quasar-ui-q-draggable-table/dist/index.css"; @@ -14,15 +13,9 @@ import th from "quasar/lang/th"; import "@vuepic/vue-datepicker/dist/main.css"; import http from "./plugins/http"; import { createPinia } from "pinia"; -// organization -// position -// positionEmployee -//calendar -// insignia // import './assets/main.css' -// Import GlobalFilters import filters from "./plugins/filters"; const app = createApp(App); @@ -81,27 +74,4 @@ app.component( ); app.config.globalProperties.$http = http; - -// authen with keycloak client -const auth = await getToken(); - -if (auth.token && auth.refresh_token) { - keycloak.init({ - checkLoginIframe: false, - token: auth.token, - refreshToken: auth.refresh_token, - }); - // .then((authenticated) => { - // console.log("authenticated", authenticated); - // if (!authenticated) { - // window.location.reload(); - // } else { - // console.log("Authenticated"); - // } - // }) - // .catch((err) => { - // console.error("Keycloak initialization failed:", err); - // }); -} - app.mount("#app"); diff --git a/src/modules/00_support/store/Main.ts b/src/modules/00_support/store/Main.ts index 3d612a96c..0a7d01cb9 100644 --- a/src/modules/00_support/store/Main.ts +++ b/src/modules/00_support/store/Main.ts @@ -12,13 +12,13 @@ import type { SupportMessageStatus, SupportIssueCategoryResponse, } from "@/modules/00_support/interface/index/Main"; -import keycloak from "@/plugins/keycloak"; import { useQuasar } from "quasar"; +import { getToken, tokenParsed } from "@/plugins/auth"; -export const useSupportStore = defineStore("supportServiceStore", () => { +export const useSupportStore = defineStore("supportServiceStore", async () => { const { showLoader, hideLoader, messageError } = useCounterMixin(); const $q = useQuasar(); - const userId = ref(keycloak.subject); + const userId = ref(""); const issue = ref(); const message = ref(); const messageStatus = ref(); @@ -44,8 +44,9 @@ export const useSupportStore = defineStore("supportServiceStore", () => { }, 150); } + const token = await getToken(); const socket = io(config.API.supportSocket, { - auth: { token: keycloak.token }, + auth: { token: token }, autoConnect: false, path: "/api/v1/support/socket/", }); @@ -54,7 +55,10 @@ export const useSupportStore = defineStore("supportServiceStore", () => { userStatus.value = data; }); - socket.on("online", (r) => { + socket.on("online", async (r) => { + const user = await tokenParsed(); + userId.value = user.subject; + userStatus.value.push({ socketId: r.socketId, userId: r.userId, diff --git a/src/modules/03_recruiting/components/Information.vue b/src/modules/03_recruiting/components/Information.vue index ab19830b7..34a57b636 100644 --- a/src/modules/03_recruiting/components/Information.vue +++ b/src/modules/03_recruiting/components/Information.vue @@ -397,6 +397,7 @@ --> + + + - - - + + +