From 18d5ef9bb64a4309cf52e6e408c94f8a00967631 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Tue, 9 Apr 2024 15:46:33 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=20append=20=E0=B8=82=E0=B8=AD=E0=B8=87=20tree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/branch/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/stores/branch/index.ts b/src/stores/branch/index.ts index d270d850..c2b91b4f 100644 --- a/src/stores/branch/index.ts +++ b/src/stores/branch/index.ts @@ -2,17 +2,19 @@ import { ref } from 'vue'; import { defineStore } from 'pinia'; import { Pagination } from '../types'; import { api } from 'src/boot/axios'; -import { Branch, BranchCreate } from './types'; +import { Branch, BranchCreate, BranchWithChildren } from './types'; const useBranchStore = defineStore('api-branch', () => { const data = ref>(); - async function fetchList( + async function fetchList( opts?: { page?: number; pageSize?: number; zipCode?: string; query?: string; + tree?: boolean; + filter?: 'head' | 'sub'; }, flow?: { sessionId: string; @@ -28,10 +30,11 @@ const useBranchStore = defineStore('api-branch', () => { if (opts?.page && opts.page > 0) params.append('page', `${opts.page}`); if (opts?.zipCode) params.append('zipCode', opts.zipCode); if (opts?.query) params.append('query', opts.query); + if (opts?.tree) params.append('tree', 'true'); const query = params.toString(); - const res = await api.get>( + const res = await api.get>( `/branch${(params && '?'.concat(query)) || ''}`, { headers: { @@ -44,7 +47,7 @@ const useBranchStore = defineStore('api-branch', () => { if (res && res.status === 200) { data.value = res.data; - return data.value; + return data.value as Pagination; } return false; }