fixing response error dialog & remove env

This commit is contained in:
Warunee Tamkoo 2024-08-28 16:27:01 +07:00
parent 3c36acbba1
commit bb476051f2
3 changed files with 13 additions and 19 deletions

7
.env
View file

@ -1,6 +1 @@
VITE_API_URI_CONFIG: "https://bma-ehr.frappet.synology.me/api/v1"
VITE_URL_KEYCLOAK: "https://id.frappet.synology.me"
VITE_REALM_KEYCLOAK: "bma-ehr"
VITE_CLIENTID_KEYCLOAK: "gettoken"
VITE_CLIENTSECRET_KEYCLOAK: "qsFwDb5anVoXKKwoeivrByIn9VYWQNRn"
VITE_API_URI_CONFIG: "https://bma-ehr.frappet.synology.me/api/v1"

View file

@ -6,16 +6,6 @@ import { setAuthen } from "@/plugins/auth";
const route = useRoute();
function setCookie(name: string, value: any, days: number) {
let expires = "";
if (days) {
const date = new Date();
date.setTime(date.getTime() + days * 24 * 60 * 55 * 1000);
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
onMounted(async () => {
if (route.query.token && route.query.accessToken) {
const params: any = await {

View file

@ -38,7 +38,16 @@ async function onSubmit() {
setAuthen(res.data.result);
})
.catch((err) => {
messageError($q, err, "ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง");
$q.dialog({
component: CustomComponent,
componentProps: {
title: `ข้อความแจ้งเตือน`,
message: `${err.response.data.message}`,
icon: "warning",
color: "red",
onlycancel: true,
},
});
})
.finally(() => {
hideLoader();
@ -46,12 +55,12 @@ async function onSubmit() {
}
onMounted(async () => {
// check authen keycloak and role of system
// check authen and role of system
const checkAuthen = await authenticated();
const checkToken: any = await tokenParsed();
if (checkAuthen) {
isDisplay.value = false;
showLoader();
const checkToken: any = await tokenParsed();
if (checkToken) {
const checkRole = (element: string) =>
element === "ADMIN" || element === "SUPER_ADMIN";