no message
This commit is contained in:
parent
8c989e84b2
commit
aa65b8165d
5 changed files with 58 additions and 24 deletions
|
|
@ -1,10 +1,17 @@
|
|||
import { ref, computed, reactive } from "vue";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRegistryInFormationStore } from "@/modules/10_registry/store/registry";
|
||||
import { useCounterMixin } from "./mixin";
|
||||
|
||||
export const useDataStore = defineStore("data", () => {
|
||||
const storeRegistry = useRegistryInFormationStore();
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, showLoader, hideLoader } = mixin;
|
||||
// ref() คือการประกาศ state เหมือน vuex
|
||||
const formData = reactive<any>({
|
||||
prefix: "",
|
||||
|
|
@ -85,12 +92,11 @@ export const useDataStore = defineStore("data", () => {
|
|||
const data = await dataPerson;
|
||||
isProbation.value = data.isProbation;
|
||||
officerType.value = data.type;
|
||||
officerLink.value = await convertEmType(data.type)
|
||||
officerLink.value = await convertEmType(data.type);
|
||||
formData.prefix = data.prefix;
|
||||
formData.firstName = data.firstName;
|
||||
formData.lastName = data.lastName;
|
||||
formData.position = data.position;
|
||||
|
||||
formData.posTypeName = data.posTypeName;
|
||||
formData.posExecutiveName = data.posExecutiveName;
|
||||
formData.posLevelName = data.posLevelName;
|
||||
|
|
@ -99,6 +105,21 @@ export const useDataStore = defineStore("data", () => {
|
|||
: "";
|
||||
storeRegistry.profileId = data.profileId;
|
||||
}
|
||||
|
||||
async function getProFileType() {
|
||||
http
|
||||
.get(config.API.proFileType)
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
officerType.value = data.type;
|
||||
officerLink.value = await convertEmType(data.type);
|
||||
hideLoader();
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
count,
|
||||
doubleCount,
|
||||
|
|
@ -119,7 +140,8 @@ export const useDataStore = defineStore("data", () => {
|
|||
getData,
|
||||
profileImg,
|
||||
formData,
|
||||
officerLink
|
||||
officerLink,
|
||||
getProFileType,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue