This commit is contained in:
Warunee Tamkoo 2025-02-10 20:44:15 +07:00
parent 49d4e4a0d6
commit 10b0bb9997

View file

@ -1,8 +1,10 @@
<script setup lang="ts">
import { deleteCookie, getCookie, setCookie } from "@/plugins/cookie";
import { computed, onMounted, ref } from "vue";
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import axios from "axios";
import { useRoute } from "vue-router";
import router from "../router";
import config from "../app.config";
@ -18,7 +20,7 @@ import line2 from "../assets/line2.png";
import type { DateCards } from "../interface/index/Main";
const $q = useQuasar();
const route = useRoute();
const cookieTokenName = ref<string>("BMAHRIS_KEYCLOAK_IDENTITY");
const cookieTokenRefName = ref<string>("BMAHRIS_KEYCLOAK_REFRESH");
const urlAdmin = config.API.URL_ADMIN;
@ -164,16 +166,15 @@ onMounted(async () => {
deleteCookie("BMAHRISCKI_KEYCLOAK_IDENTITY");
deleteCookie("BMAHRISUSER_KEYCLOAK_IDENTITY");
const uid = await getCookie("uid");
console.log("uid===>", uid);
const uid = route.query.uid?.toString() || "";
await axios
.post(
`${config.API.sso}/kcauth`,
{ uid: uid },
{},
{
headers: {
"Content-Type": "application/json",
uid: uid,
},
withCredentials: true, // Include cookies with the request
}
@ -199,7 +200,7 @@ onMounted(async () => {
if (location.hostname == "hrms.chin.in.th") {
router.push("/sso");
} else {
// window.location.href = `${config.API.URL_SSO}`;
window.location.href = `${config.API.URL_SSO}`;
}
});