From a61dfb8789699ecd18d7e9f7f0d96b048312df73 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Sun, 19 Mar 2023 00:59:27 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=B4=E0=B8=94=20api=20=E0=B8=97?= =?UTF-8?q?=E0=B8=B5=E0=B9=88=E0=B8=A2=E0=B8=B1=E0=B8=87=E0=B9=84=E0=B8=A1?= =?UTF-8?q?=E0=B9=88=E0=B9=84=E0=B8=94=E0=B9=88=E0=B9=83=E0=B8=8A=E0=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 13 +- .../01_exam/components/Form/Education.vue | 28 ++-- .../components/Form/Profile/Address.vue | 120 +++++++++--------- .../components/Form/Profile/Information.vue | 32 ++--- src/modules/02_meta/store.ts | 10 ++ src/views/MainLayout.vue | 2 +- 6 files changed, 109 insertions(+), 96 deletions(-) diff --git a/src/main.ts b/src/main.ts index 8ee987c..5cfd907 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,22 +1,23 @@ import { createApp, defineAsyncComponent } from 'vue' -import { createPinia } from 'pinia' -import { Dialog, Notify, Quasar } from 'quasar' - import App from './App.vue' import router from './router' +import { Dialog, Notify, Quasar } from 'quasar' import quasarUserOptions from './quasar-user-options' -import '@vuepic/vue-datepicker/dist/main.css' import 'quasar/src/css/index.sass' import th from 'quasar/lang/th' +import '@vuepic/vue-datepicker/dist/main.css' +import http from './plugins/http' +import { createPinia } from 'pinia' + // import './assets/main.css' const app = createApp(App) const pinia = createPinia() -app.use(pinia) app.use(router) +app.use(pinia) app.use( Quasar, @@ -52,4 +53,6 @@ app.component( defineAsyncComponent(() => import('./plugins/FullLoader.vue')) ) +app.config.globalProperties.$http = http + app.mount('#app') diff --git a/src/modules/01_exam/components/Form/Education.vue b/src/modules/01_exam/components/Form/Education.vue index 23d164d..42933f5 100644 --- a/src/modules/01_exam/components/Form/Education.vue +++ b/src/modules/01_exam/components/Form/Education.vue @@ -333,20 +333,20 @@ onMounted(async () => { const fetchQualification = async () => { // loader.value = true; - await http - .get(config.API.educationQualification) - .then((res) => { - const data = res.data.result - let option: DataOption[] = [] - data.map((r: any) => { - option.push({ id: r.id.toString(), name: r.name.toString() }) - }) - qualificationOptions.value = option - }) - .catch((e: any) => {}) - .finally(() => { - // loader.value = false; - }) + // await http + // .get(config.API.educationQualification) + // .then((res) => { + // const data = res.data.result + // let option: DataOption[] = [] + // data.map((r: any) => { + // option.push({ id: r.id.toString(), name: r.name.toString() }) + // }) + // qualificationOptions.value = option + // }) + // .catch((e: any) => {}) + // .finally(() => { + // // loader.value = false; + // }) } const fetchData = async () => {} diff --git a/src/modules/01_exam/components/Form/Profile/Address.vue b/src/modules/01_exam/components/Form/Profile/Address.vue index 1a0811c..a2e284d 100644 --- a/src/modules/01_exam/components/Form/Profile/Address.vue +++ b/src/modules/01_exam/components/Form/Profile/Address.vue @@ -342,72 +342,72 @@ const selectSubDistrict = (e: string, name: string) => { } const fetchProvince = async () => { - // loader.value = true; - await http - .get(config.API.province) - .then((res) => { - const data = res.data.result - let option: DataOption[] = [] - // console.log(data); - data.map((r: any) => { - option.push({ id: r.id.toString(), name: r.name.toString() }) - }) - provinceOptions.value = option - }) - .catch((e: any) => {}) - .finally(() => { - // loader.value = false; - }) + // // loader.value = true; + // await http + // .get(config.API.province) + // .then((res) => { + // const data = res.data.result + // let option: DataOption[] = [] + // // console.log(data); + // data.map((r: any) => { + // option.push({ id: r.id.toString(), name: r.name.toString() }) + // }) + // provinceOptions.value = option + // }) + // .catch((e: any) => {}) + // .finally(() => { + // // loader.value = false; + // }) } const fetchDistrict = async (id: string, position: string) => { - // loader.value = true; - await http - .get(config.API.listDistrict(id)) - .then((res) => { - const data = res.data.result - let option: DataOption[] = [] - // console.log(data); - data.map((r: any) => { - option.push({ id: r.id.toString(), name: r.name.toString() }) - }) - if (position == '1') { - districtOptions.value = option - } else { - districtCOptions.value = option - } - }) - .catch((e: any) => {}) - .finally(() => { - // loader.value = false; - }) + // // loader.value = true; + // await http + // .get(config.API.listDistrict(id)) + // .then((res) => { + // const data = res.data.result + // let option: DataOption[] = [] + // // console.log(data); + // data.map((r: any) => { + // option.push({ id: r.id.toString(), name: r.name.toString() }) + // }) + // if (position == '1') { + // districtOptions.value = option + // } else { + // districtCOptions.value = option + // } + // }) + // .catch((e: any) => {}) + // .finally(() => { + // // loader.value = false; + // }) } const fetchSubDistrict = async (id: string, position: string) => { - // loader.value = true; - await http - .get(config.API.listSubDistrict(id)) - .then((res) => { - const data = res.data.result - let option: zipCodeOption[] = [] - // console.log(res); - data.map((r: any) => { - option.push({ - id: r.id.toString(), - name: r.name.toString(), - zipCode: r.zipCode.toString() - }) - }) - if (position == '1') { - subdistrictOptions.value = option - } else { - subdistrictCOptions.value = option - } - }) - .catch((e: any) => {}) - .finally(() => { - // loader.value = false; - }) + // // loader.value = true; + // await http + // .get(config.API.listSubDistrict(id)) + // .then((res) => { + // const data = res.data.result + // let option: zipCodeOption[] = [] + // // console.log(res); + // data.map((r: any) => { + // option.push({ + // id: r.id.toString(), + // name: r.name.toString(), + // zipCode: r.zipCode.toString() + // }) + // }) + // if (position == '1') { + // subdistrictOptions.value = option + // } else { + // subdistrictCOptions.value = option + // } + // }) + // .catch((e: any) => {}) + // .finally(() => { + // // loader.value = false; + // }) } const cancelData = () => {} diff --git a/src/modules/01_exam/components/Form/Profile/Information.vue b/src/modules/01_exam/components/Form/Profile/Information.vue index 4df08cf..ccd2e58 100644 --- a/src/modules/01_exam/components/Form/Profile/Information.vue +++ b/src/modules/01_exam/components/Form/Profile/Information.vue @@ -415,22 +415,22 @@ const changeBtn = async () => { } const fetchProvince = async () => { - // loader.value = true; - await http - .get(config.API.province) - .then((res) => { - const data = res.data.result - let option: DataOption[] = [] - // console.log(data); - data.map((r: any) => { - option.push({ id: r.id.toString(), name: r.name.toString() }) - }) - provinceOptions.value = option - }) - .catch((e: any) => {}) - .finally(() => { - // loader.value = false; - }) + // // loader.value = true; + // await http + // .get(config.API.province) + // .then((res) => { + // const data = res.data.result + // let option: DataOption[] = [] + // // console.log(data); + // data.map((r: any) => { + // option.push({ id: r.id.toString(), name: r.name.toString() }) + // }) + // provinceOptions.value = option + // }) + // .catch((e: any) => {}) + // .finally(() => { + // // loader.value = false; + // }) } const savePic = () => { diff --git a/src/modules/02_meta/store.ts b/src/modules/02_meta/store.ts index e69de29..b0e868c 100644 --- a/src/modules/02_meta/store.ts +++ b/src/modules/02_meta/store.ts @@ -0,0 +1,10 @@ +import { ref, computed } from 'vue' +import { defineStore } from 'pinia' + +export const useMetaStore = defineStore('meta', () => { + const meta = ref('') + + return { + meta + } +}) diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 23f3347..941e7b7 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -64,7 +64,7 @@ const doLogout = () => { - +