Skip to content

Commit

Permalink
update context.url redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
puncsky committed Jan 20, 2021
1 parent 3ad944b commit 2ce3f58
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export function isoReactRenderMiddleware(server: Server): Middleware {

const context = {
url: undefined,
statusCode: undefined,
status: undefined,
statusCode: 200,
status: 200,
};
initClientI18n(ctx.state.view.base.translations);
const reactMarkup = renderToString(
Expand All @@ -50,14 +50,15 @@ export function isoReactRenderMiddleware(server: Server): Middleware {

// This will contain the URL to redirect to if <Redirect> was used
if (context.url) {
// @ts-ignore
return ctx.redirect(context.url);
ctx.redirect(
context.statusCode ? String(context.statusCode) : "302",
context.url
);
return "";
}
if (context.statusCode) {
// @ts-ignore
ctx.status = context.statusCode;
} else if (context.status) {
// @ts-ignore
ctx.status = context.status;
}

Expand Down

0 comments on commit 2ce3f58

Please sign in to comment.