Browse Source

fix(nocodb): return error for hook test

pull/5349/head
Wing-Kam Wong 1 year ago
parent
commit
3680378e54
  1. 20
      packages/nocodb/src/lib/controllers/hook.ctl.ts

20
packages/nocodb/src/lib/controllers/hook.ctl.ts

@ -46,11 +46,21 @@ export async function hookUpdate(
}
export async function hookTest(req: Request<any, any>, res: Response) {
await hookService.hookTest({
hookTest: req.body,
tableId: req.params.tableId,
});
res.json({ msg: 'The hook has been tested successfully' });
try {
await hookService.hookTest({
hookTest: {
...req.body,
payload: {
...req.body.payload,
user: (req as any)?.user,
},
},
tableId: req.params.tableId,
});
res.json({ msg: 'The hook has been tested successfully' });
} catch (e) {
throw e;
}
}
export async function tableSampleData(req: Request, res: Response) {

Loading…
Cancel
Save