Skip to content

Commit b518075

Browse files
committed
fix: resolve typescript issues
1 parent 47ecc47 commit b518075

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

adminforth/types/Back.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ export interface AdminForthActionInput {
729729
};
730730
allowed?: (params: {
731731
adminUser: AdminUser;
732-
standardAllowedActions: AllowedActionsEnum[];
732+
standardAllowedActions: AllowedActions;
733733
}) => boolean;
734734
url?: string;
735735
action?: (params: {
@@ -1168,10 +1168,38 @@ export interface ResourceOptionsInput extends Omit<AdminForthResourceCommon['opt
11681168
*
11691169
*/
11701170
allowedActions?: AllowedActionsInput,
1171+
1172+
/**
1173+
* Array of actions which will be displayed in the resource.
1174+
*
1175+
* Example:
1176+
*
1177+
* ```ts
1178+
* actions: [
1179+
* {
1180+
* name: 'Auto submit',
1181+
* allowed: ({ adminUser, standardAllowedActions }) => {
1182+
* return adminUser.dbUser.role === 'superadmin';
1183+
* },
1184+
* action: ({ adminUser, resource, recordId, adminforth, extra, tr }) => {
1185+
* console.log("auto submit", recordId, adminUser);
1186+
* return { ok: true, successMessage: "Auto submitted" };
1187+
* },
1188+
* showIn: {
1189+
* list: true,
1190+
* showButton: true,
1191+
* showThreeDotsMenu: true,
1192+
* },
1193+
* },
1194+
* ]
1195+
* ```
1196+
*/
1197+
actions?: Array<AdminForthActionInput>,
11711198
};
11721199

11731200
export interface ResourceOptions extends Omit<ResourceOptionsInput, 'allowedActions'> {
11741201
allowedActions: AllowedActions,
1202+
actions?: Array<AdminForthActionInput>,
11751203
}
11761204

11771205
/**

0 commit comments

Comments
 (0)