diff --git a/src/stores/address/index.ts b/src/stores/address/index.ts index 6688eeda..c2b1f654 100644 --- a/src/stores/address/index.ts +++ b/src/stores/address/index.ts @@ -35,11 +35,27 @@ export interface Province { id: string; } +export interface Office { + provinceId: string; + nameEN: string; + name: string; + id: string; +} + const useAddressStore = defineStore('api-address', () => { const province = ref(); const district = ref>({}); const subDistrict = ref>({}); + async function fetchOffice(opts?: { districtId?: string; query?: string }) { + const res = await api.get('/employment-office', { + params: opts, + }); + + if (res.status >= 400) return null; + return res.data; + } + async function fetchProvince() { if (province.value) return province.value; @@ -81,6 +97,7 @@ const useAddressStore = defineStore('api-address', () => { } return { + fetchOffice, fetchProvince, fetchDistrictByProvinceId, fetchSubDistrictByProvinceId,