From 35c44293193a0068c0e6dead7129523fe65d6a8f Mon Sep 17 00:00:00 2001 From: Mirza Hanan Date: Tue, 24 Sep 2024 15:53:24 +0500 Subject: [PATCH] fix(search-filter): connect Search filter and endpoint request --- src/stores/useDataStore/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/stores/useDataStore/index.ts b/src/stores/useDataStore/index.ts index 155222346..80d12d6d0 100644 --- a/src/stores/useDataStore/index.ts +++ b/src/stores/useDataStore/index.ts @@ -18,6 +18,10 @@ export type FetchNodeParams = { skip_cache?: string free?: string media_type?: string + node_type?: string + limit?: string + depth?: string + top_node_count?: string } export type SidebarFilterWithCount = { @@ -136,7 +140,7 @@ export const useDataStore = create()( devtools((set, get) => ({ ...defaultData, - fetchData: async (setBudget, setAbortRequests, AISearchQuery = '') => { + fetchData: async (setBudget, setAbortRequests, AISearchQuery = '', params: FetchNodeParams = {}) => { const { dataInitial: existingData, filters } = get() const currentPage = filters.skip const itemsPerPage = filters.limit @@ -174,6 +178,7 @@ export const useDataStore = create()( const updatedParams = { ...withoutNodeType, + ...params, ...ai, skip: currentPage === 0 ? String(currentPage * itemsPerPage) : String(currentPage * itemsPerPage + 1), limit: word ? '25' : String(itemsPerPage),