ทะเบียนประวัติ fetch api

This commit is contained in:
Thanit Konmek 2023-06-15 17:22:20 +07:00
parent 67e0f695c1
commit 5fbfaa9a88
3 changed files with 42 additions and 40 deletions

View file

@ -60,9 +60,9 @@ import Occupation from "@/modules/03_recruiting/components/Occupation.vue";
import Education from "@/modules/03_recruiting/components/Education.vue";
import Career from "@/modules/03_recruiting/components/Career.vue";
import Document from "@/modules/03_recruiting/components/Document.vue";
import { useDataStore } from "@/stores/data";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useManageDataStore } from "@/modules/01_metadata/store";
const props = defineProps({
status: {
@ -88,8 +88,9 @@ const props = defineProps({
});
const $q = useQuasar();
const dataStore = useDataStore();
const { loaderPage } = dataStore;
const store = useManageDataStore();
const { getPrefix } = store;
const prefixOptions = ref<DataOption[]>([]);
const relationshipOptions = ref<DataOption[]>([]);
const provinceOptions = ref<DataOption[]>([]);
@ -131,23 +132,15 @@ onMounted(() => {
});
const fetchPrefix = async () => {
showLoader();
await http
.get(config.API.prefix)
.then((res) => {
const data = res.data.result;
let option: DataOption[] = [];
data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() });
});
prefixOptions.value = option;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
const result = await getPrefix(true, false);
const data = result.data;
let option: DataOption[] = [];
if (data.length > 0) {
data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() });
});
}
prefixOptions.value = option;
};
const fetchRelationship = async () => {