refactor: create fetch office by id

This commit is contained in:
Thanaphon Frappet 2024-11-14 17:51:38 +07:00
parent b1d08b19ee
commit fda0d581ae

View file

@ -55,6 +55,12 @@ const useAddressStore = defineStore('api-address', () => {
if (res.status >= 400) return null;
return res.data;
}
async function fetchOfficeById(id: string) {
const res = await api.get<Office>(`/employment-office/${id}`);
if (res.status >= 400) return null;
return res.data;
}
async function fetchProvince() {
if (province.value) return province.value;
@ -98,6 +104,7 @@ const useAddressStore = defineStore('api-address', () => {
return {
fetchOffice,
fetchOfficeById,
fetchProvince,
fetchDistrictByProvinceId,
fetchSubDistrictByProvinceId,