Skip to content

Commit c48f422

Browse files
committed
feat: allow actions to set cookies
1 parent 978256d commit c48f422

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

adminforth/modules/restApi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
14871487
server.endpoint({
14881488
method: 'POST',
14891489
path: '/start_custom_action',
1490-
handler: async ({ body, adminUser, tr, cookies }) => {
1490+
handler: async ({ body, adminUser, tr, cookies, response }) => {
14911491
const { resourceId, actionId, recordId, extra } = body;
14921492
const resource = this.adminforth.config.resources.find((res) => res.resourceId == resourceId);
14931493
if (!resource) {
@@ -1519,13 +1519,13 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
15191519
redirectUrl: action.url
15201520
}
15211521
}
1522-
const response = await action.action({ recordId, adminUser, resource, tr, adminforth: this.adminforth, extra: {...extra, cookies: cookies} });
1522+
const actionResponse = await action.action({ recordId, adminUser, resource, tr, adminforth: this.adminforth, response, extra: {...extra, cookies: cookies} });
15231523

15241524
return {
15251525
actionId,
15261526
recordId,
15271527
resourceId,
1528-
...response
1528+
...actionResponse
15291529
}
15301530
}
15311531
});

adminforth/types/Back.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ export interface AdminForthActionInput {
862862
resource: AdminForthResource;
863863
recordId: string;
864864
adminUser: AdminUser;
865+
response: IAdminForthHttpResponse;
865866
extra?: HttpExtra;
866867
tr: Function;
867868
}) => Promise<{

0 commit comments

Comments
 (0)