Skip to content

Commit

Permalink
feat: 🎸 GenericError can modify action and options params
Browse files Browse the repository at this point in the history
  • Loading branch information
mjancarik committed Jun 11, 2021
1 parent 379ead7 commit 305436b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/core/src/router/ClientRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,20 @@ export default class ClientRouter extends AbstractRouter {
}

if (this.isRedirection(params.error)) {
let errorParams = params.error.getParams();
options.httpStatus = params.error.getHttpStatus();
this.redirect(params.error.getParams().url, options);
let action = {
event: null,
type: ActionTypes.REDIRECT,
url: errorParams.url
};

this.redirect(
errorParams.url,
Object.assign(options, errorParams.options),
Object.assign(action, errorParams.action),
locals
);
return Promise.resolve({
content: null,
status: options.httpStatus,
Expand Down

0 comments on commit 305436b

Please sign in to comment.