From fda0d581ae056b5cb780dbe4ce60ec020f457e47 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Thu, 14 Nov 2024 17:51:38 +0700 Subject: [PATCH] refactor: create fetch office by id --- src/stores/address/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stores/address/index.ts b/src/stores/address/index.ts index c2b1f654..975ca773 100644 --- a/src/stores/address/index.ts +++ b/src/stores/address/index.ts @@ -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(`/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,