24 lines
585 B
JavaScript
24 lines
585 B
JavaScript
|
|
import { ref } from "vue";
|
||
|
|
import { defineStore } from "pinia";
|
||
|
|
import api from '@/utils/api';
|
||
|
|
|
||
|
|
|
||
|
|
export default defineStore("dbStore", () => {
|
||
|
|
const jobMap = ref({})
|
||
|
|
|
||
|
|
async function getJobs() {
|
||
|
|
const res = await api('getCorpMemberJob', {}, false);
|
||
|
|
if (res && res.success) {
|
||
|
|
const arr = Array.isArray(res.data) ? res.data : [];
|
||
|
|
jobMap.value = arr.reduce((map, item) => {
|
||
|
|
if (item.name && item.value) {
|
||
|
|
map[item.value] = item.name
|
||
|
|
}
|
||
|
|
return map
|
||
|
|
}, {})
|
||
|
|
}
|
||
|
|
console.log(jobMap.value)
|
||
|
|
}
|
||
|
|
|
||
|
|
return { jobMap, getJobs }
|
||
|
|
})
|