Skip to main content

BeforeDataSourceRequestFunction()

BeforeDataSourceRequestFunction = (params) => Promise<{ error?: string; newRecordId?: string; ok: boolean; }>

Modify query to change how data is fetched from database. Return ok: false and error: string to stop execution and show error message to user. Return ok: true to continue execution.

Parameters

ParameterType
params{ adminforth: IAdminForth; adminUser: AdminUser; extra: { body: any; cookies: Record<string, string>; headers: Record<string, string>; query: Record<string, string>; requestUrl: string; }; query: any; resource: AdminForthResource; }
params.adminforthIAdminForth
params.adminUserAdminUser
params.extra{ body: any; cookies: Record<string, string>; headers: Record<string, string>; query: Record<string, string>; requestUrl: string; }
params.extra.bodyany
params.extra.cookiesRecord<string, string>
params.extra.headersRecord<string, string>
params.extra.queryRecord<string, string>
params.extra.requestUrlstring
params.queryany
params.resourceAdminForthResource

Returns

Promise<{ error?: string; newRecordId?: string; ok: boolean; }>