mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: request pagination for resource(#1425)
* feat: add support for resource page on frontend * [WIP]feat: add backend support for limit and offset search * feat: add reducer to add resource * support fetch all resource when first search * beautify the fetch ui * restore file * feat: add all resource before clear resource * eslint * i18n * chore:change the nane * chore: change the name of param * eslint * feat: setIsComplete to true when first loading resource fully * fix the bug of fetch * feat change finally to then * feat: add await and async to clear and search * feat: return all resource when fetch * chore: change variable name * Update web/src/pages/ResourcesDashboard.tsx Co-authored-by: boojack <stevenlgtm@gmail.com> * fix missing const value --------- Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
@ -164,6 +164,17 @@ export function getResourceList() {
|
||||
return axios.get<ResponseObject<Resource[]>>("/api/resource");
|
||||
}
|
||||
|
||||
export function getResourceListWithLimit(resourceFind?: ResourceFind) {
|
||||
const queryList = [];
|
||||
if (resourceFind?.offset) {
|
||||
queryList.push(`offset=${resourceFind.offset}`);
|
||||
}
|
||||
if (resourceFind?.limit) {
|
||||
queryList.push(`limit=${resourceFind.limit}`);
|
||||
}
|
||||
return axios.get<ResponseObject<Resource[]>>(`/api/resource?${queryList.join("&")}`);
|
||||
}
|
||||
|
||||
export function createResource(resourceCreate: ResourceCreate) {
|
||||
return axios.post<ResponseObject<Resource>>("/api/resource", resourceCreate);
|
||||
}
|
||||
|
Reference in New Issue
Block a user