From da31120a9ddab0afe0d2d703366814e42c8c86fc Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 17 Dec 2024 18:10:54 +0700 Subject: [PATCH] api --- src/api/api.sso.ts | 8 ++++++++ src/api/index.ts | 22 ++++++++++++++++++++++ src/views/home.vue | 15 ++++++++++----- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/api/api.sso.ts b/src/api/api.sso.ts index d790271..eebbba1 100644 --- a/src/api/api.sso.ts +++ b/src/api/api.sso.ts @@ -1,7 +1,15 @@ import env from "./index"; const sso = `${env.API_SSO}`; // const log = `${env.API_URI}/log`; +const API_URL_ADMIN = `${env.API_URL_ADMIN}`; +const API_URL_USER = `${env.API_URL_USER}`; +const API_URL_MGT = `${env.API_URL_MGT}`; +const API_URL_CHECKIN = `${env.API_URL_CHECKIN}`; export default { sso, + API_URL_ADMIN, + API_URL_USER, + API_URL_MGT, + API_URL_CHECKIN, }; diff --git a/src/api/index.ts b/src/api/index.ts index e63fa38..373ccab 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -4,6 +4,11 @@ import { ref } from "vue"; const env = ref(process.env.NODE_ENV || "development"); export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG; export const apiUrlSsoConfig = import.meta.env.VITE_API_SSO; +export const urlAdmin = import.meta.env.VITE_URL_ADMIN; +export const urlUser = import.meta.env.VITE_URL_USER; +export const urlMgt = import.meta.env.VITE_URL_MGT; +export const urlCheckin = import.meta.env.VITE_URL_CHECKIN; + // if (process.env.VUE_APP_TEST) { // env = "test"; // } @@ -13,6 +18,10 @@ const config = ref({ // API_URI: "https://localhost:7260/api", API_URI: "https://bma-ehr.frappet.synology.me/api/v1", API_SSO: "https://localhost:3001", + VITE_URL_ADMIN: urlAdmin, + VITE_URL_USER: urlUser, + VITE_URL_MGT: urlMgt, + VITE_URL_CHECKIN: urlCheckin, }, test: { API_URI: "http://localhost:5010/api/v1", @@ -20,15 +29,28 @@ const config = ref({ production: { API_URI: apiUrlConfig, API_SSO: apiUrlSsoConfig, + VITE_URL_ADMIN: urlAdmin, + VITE_URL_USER: urlUser, + VITE_URL_MGT: urlMgt, + VITE_URL_CHECKIN: urlCheckin, }, }); const API_URI = ref(config.value[env.value].API_URI); const API_SSO = ref(config.value[env.value].API_SSO); +const API_URL_ADMIN = ref(config.value[env.value].VITE_URL_ADMIN); +const API_URL_USER = ref(config.value[env.value].VITE_URL_USER); +const API_URL_MGT = ref(config.value[env.value].VITE_URL_MGT); +const API_URL_CHECKIN = ref(config.value[env.value].VITE_URL_CHECKIN); + export default { env: env.value, config: config.value, API_URI: API_URI.value, API_SSO: API_SSO.value, + API_URL_ADMIN: API_URL_ADMIN.value, + API_URL_USER: API_URL_USER.value, + API_URL_MGT: API_URL_MGT.value, + API_URL_CHECKIN: API_URL_CHECKIN.value, }; diff --git a/src/views/home.vue b/src/views/home.vue index 986c751..f4b1fae 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -16,10 +16,15 @@ import type { DateCards } from "@/interface/index/Main"; const $q = useQuasar(); -const urlAdmin = import.meta.env.VITE_URL_ADMIN ?? ""; -const urlUser = import.meta.env.VITE_URL_USER ?? ""; -const urlMgt = import.meta.env.VITE_URL_MGT ?? ""; -const urlCheckin = import.meta.env.VITE_URL_CHECKIN ?? ""; +const urlAdmin = config.API.API_URL_ADMIN ?? ""; +const urlUser = config.API.API_URL_USER ?? ""; +const urlMgt = config.API.API_URL_MGT ?? ""; +const urlCheckin = config.API.API_URL_CHECKIN ?? ""; + +console.log(config.API.API_URL_ADMIN); +console.log(config.API.API_URL_USER); +console.log(config.API.API_URL_MGT); +console.log(config.API.API_URL_CHECKIN); const cards = ref([ { @@ -207,7 +212,7 @@ onMounted(async () => { class="q-mt-xl" :class="!$q.screen.gt.md ? 'row justify-center' : ''" > -
+