From 8f14bac6d732d48291bcafe95f2e79f5c929907e Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Mon, 6 Feb 2023 17:14:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/utils/files/fileinfo.go | 3 +++ frontend/src/api/index.ts | 8 ++++++-- frontend/src/api/modules/files.ts | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/utils/files/fileinfo.go b/backend/utils/files/fileinfo.go index ecda89753..098ff4732 100644 --- a/backend/utils/files/fileinfo.go +++ b/backend/utils/files/fileinfo.go @@ -115,6 +115,9 @@ func (f *FileInfo) search(dir, showHidden bool, af afero.Afero, search string, c Path: path, FileInfo: info, }) + if len(files) > count { + return nil + } } } return nil diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 477e9f95a..20f96d64b 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -89,8 +89,12 @@ class RequestHttp { get(url: string, params?: object, _object = {}): Promise> { return this.service.get(url, { params, ..._object }); } - post(url: string, params?: object, _object = {}): Promise> { - return this.service.post(url, params, _object); + post(url: string, params?: object, timeout?: number): Promise> { + return this.service.post(url, params, { + baseURL: import.meta.env.VITE_API_URL as string, + timeout: timeout ? timeout : (ResultEnum.TIMEOUT as number), + withCredentials: true, + }); } put(url: string, params?: object, _object = {}): Promise> { return this.service.put(url, params, _object); diff --git a/frontend/src/api/modules/files.ts b/frontend/src/api/modules/files.ts index 43babce3e..6a58f7eed 100644 --- a/frontend/src/api/modules/files.ts +++ b/frontend/src/api/modules/files.ts @@ -3,7 +3,7 @@ import http from '@/api'; import { AxiosRequestConfig } from 'axios'; export const GetFilesList = (params: File.ReqFile) => { - return http.post('files/search', params); + return http.post('files/search', params, 200000); }; export const GetFilesTree = (params: File.ReqFile) => {