25 lines
766 B
TypeScript
25 lines
766 B
TypeScript
import { defineStore } from "pinia";
|
|
import { ref } from "vue";
|
|
import http from "@/plugins/http";
|
|
import config from "@/app.config";
|
|
|
|
import type { DataRoleWorkflow } from "@/interface/response/main";
|
|
|
|
export const useRoleWorkflowDataStore = defineStore("rolewrokflow", () => {
|
|
const dataRole = ref<{ [key: string]: DataRoleWorkflow[] }>({});
|
|
|
|
async function fetchDataCheckIsoffice(sysKey: string) {
|
|
if (dataRole.value[sysKey]) {
|
|
return dataRole.value[sysKey] || [];
|
|
} else {
|
|
try {
|
|
const res = await http.get(config.API.checkIsofficer + `${sysKey}`);
|
|
dataRole.value[sysKey] = res.data.result;
|
|
return res.data.result;
|
|
} catch (err) {
|
|
throw err;
|
|
}
|
|
}
|
|
}
|
|
return { fetchDataCheckIsoffice };
|
|
});
|