fixing response error dialog & remove env
This commit is contained in:
parent
3c36acbba1
commit
bb476051f2
3 changed files with 13 additions and 19 deletions
7
.env
7
.env
|
|
@ -1,6 +1 @@
|
||||||
VITE_API_URI_CONFIG: "https://bma-ehr.frappet.synology.me/api/v1"
|
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"
|
|
||||||
|
|
@ -6,16 +6,6 @@ import { setAuthen } from "@/plugins/auth";
|
||||||
|
|
||||||
const route = useRoute();
|
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 () => {
|
onMounted(async () => {
|
||||||
if (route.query.token && route.query.accessToken) {
|
if (route.query.token && route.query.accessToken) {
|
||||||
const params: any = await {
|
const params: any = await {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,16 @@ async function onSubmit() {
|
||||||
setAuthen(res.data.result);
|
setAuthen(res.data.result);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err, "ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง");
|
$q.dialog({
|
||||||
|
component: CustomComponent,
|
||||||
|
componentProps: {
|
||||||
|
title: `ข้อความแจ้งเตือน`,
|
||||||
|
message: `${err.response.data.message}`,
|
||||||
|
icon: "warning",
|
||||||
|
color: "red",
|
||||||
|
onlycancel: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|
@ -46,12 +55,12 @@ async function onSubmit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// check authen keycloak and role of system
|
// check authen and role of system
|
||||||
const checkAuthen = await authenticated();
|
const checkAuthen = await authenticated();
|
||||||
const checkToken: any = await tokenParsed();
|
|
||||||
if (checkAuthen) {
|
if (checkAuthen) {
|
||||||
isDisplay.value = false;
|
isDisplay.value = false;
|
||||||
showLoader();
|
showLoader();
|
||||||
|
const checkToken: any = await tokenParsed();
|
||||||
if (checkToken) {
|
if (checkToken) {
|
||||||
const checkRole = (element: string) =>
|
const checkRole = (element: string) =>
|
||||||
element === "ADMIN" || element === "SUPER_ADMIN";
|
element === "ADMIN" || element === "SUPER_ADMIN";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue