Skip to content

Commit f1189f9

Browse files
committed
chore: add filtersTools parameter to BeforeDataSourceRequestFunction type and update usage in AdminForthRestAPI
https://web.tracklify.com/project/2b7ZVgE5/AdminForth/1252/m2mkPyFz/there-is-no-filter-tools-prop-
1 parent 28d922d commit f1189f9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

adminforth/modules/restApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,10 +733,10 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
733733
'edit': 'show',
734734
}[source];
735735

736-
for (const hook of listify(resource.hooks?.[hookSource]?.beforeDatasourceRequest)) {
736+
for (const hook of listify(resource.hooks?.[hookSource]?.beforeDatasourceRequest as BeforeDataSourceRequestFunction[])) {
737737
const filterTools = filtersTools.get(body);
738738
body.filtersTools = filterTools;
739-
const resp = await hook({
739+
const resp = await (hook as BeforeDataSourceRequestFunction)({
740740
resource,
741741
query: body,
742742
adminUser,

adminforth/types/Back.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ export type BeforeDataSourceRequestFunction = (params: {
515515
cookies: Record<string, string>,
516516
requestUrl: string,
517517
},
518+
filtersTools: any,
518519
adminforth: IAdminForth,
519520
}) => Promise<{
520521
ok: boolean,

0 commit comments

Comments
 (0)