fixing api
This commit is contained in:
parent
f0c4af2c48
commit
374445f686
5 changed files with 26 additions and 10 deletions
7
src/api/api.sso.ts
Normal file
7
src/api/api.sso.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import env from "./index";
|
||||||
|
const sso = `${env.API_SSO}`;
|
||||||
|
// const log = `${env.API_URI}/log`;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
sso,
|
||||||
|
};
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
/**config api */
|
/**config api */
|
||||||
import { ref } from 'vue'
|
import { ref } from "vue";
|
||||||
|
|
||||||
const env = ref<string>(process.env.NODE_ENV || 'development')
|
const env = ref<string>(process.env.NODE_ENV || "development");
|
||||||
export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG
|
export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG;
|
||||||
|
export const apiUrlSsoConfig = import.meta.env.VITE_API_SSO;
|
||||||
// if (process.env.VUE_APP_TEST) {
|
// if (process.env.VUE_APP_TEST) {
|
||||||
// env = "test";
|
// env = "test";
|
||||||
// }
|
// }
|
||||||
|
|
@ -10,20 +11,24 @@ export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG
|
||||||
const config = ref<any>({
|
const config = ref<any>({
|
||||||
development: {
|
development: {
|
||||||
// API_URI: "https://localhost:7260/api",
|
// API_URI: "https://localhost:7260/api",
|
||||||
API_URI: 'https://bma-ehr.frappet.synology.me/api/v1',
|
API_URI: "https://bma-ehr.frappet.synology.me/api/v1",
|
||||||
|
API_SSO: "https://localhost:3001",
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
API_URI: 'http://localhost:5010/api/v1',
|
API_URI: "http://localhost:5010/api/v1",
|
||||||
},
|
},
|
||||||
production: {
|
production: {
|
||||||
API_URI: apiUrlConfig,
|
API_URI: apiUrlConfig,
|
||||||
|
API_SSO: apiUrlSsoConfig,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const API_URI = ref<string>(config.value[env.value].API_URI)
|
const API_URI = ref<string>(config.value[env.value].API_URI);
|
||||||
|
const API_SSO = ref<string>(config.value[env.value].API_SSO);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
env: env.value,
|
env: env.value,
|
||||||
config: config.value,
|
config: config.value,
|
||||||
API_URI: API_URI.value,
|
API_URI: API_URI.value,
|
||||||
}
|
API_SSO: API_SSO.value,
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
/** API ระบบลงเวลา */
|
/** API ระบบลงเวลา */
|
||||||
import org from "@/api/api.org";
|
import org from "@/api/api.org";
|
||||||
|
import sso from "@/api/api.sso";
|
||||||
|
|
||||||
const API = {
|
const API = {
|
||||||
/**message */
|
/**message */
|
||||||
...org,
|
...org,
|
||||||
|
...sso,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import router from "@/router";
|
||||||
import { computed, onMounted, ref } from "vue";
|
import { computed, onMounted, ref } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
import CustomComponent from "@/components/CustomDialog.vue";
|
import CustomComponent from "@/components/CustomDialog.vue";
|
||||||
|
|
||||||
|
|
@ -98,7 +99,7 @@ onMounted(async () => {
|
||||||
if (!checkToken && !token.value) {
|
if (!checkToken && !token.value) {
|
||||||
await axios
|
await axios
|
||||||
.post(
|
.post(
|
||||||
`${import.meta.env.VITE_API_SSO}/kcauth`,
|
`${config.API.sso}/kcauth`,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
@ -28,7 +29,7 @@ async function onSubmit() {
|
||||||
|
|
||||||
await axios
|
await axios
|
||||||
.post(
|
.post(
|
||||||
`${import.meta.env.VITE_API_SSO}/signin`,
|
`${config.API.sso}/signin`,
|
||||||
{
|
{
|
||||||
username: username.value,
|
username: username.value,
|
||||||
password: password.value,
|
password: password.value,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue