From a24b0091ad40cbc581cfa2f6560c09b3589d8b7d Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 16 May 2021 12:19:18 +0200 Subject: [PATCH] Server: Go back to home page when there is an error and user is logged in --- packages/server/src/middleware/routeHandler.ts | 1 + packages/server/src/views/index/error.mustache | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/server/src/middleware/routeHandler.ts b/packages/server/src/middleware/routeHandler.ts index 399ce114c..74dd2ebfa 100644 --- a/packages/server/src/middleware/routeHandler.ts +++ b/packages/server/src/middleware/routeHandler.ts @@ -52,6 +52,7 @@ export default async function(ctx: AppContext) { content: { error, stack: ctx.env === Env.Dev ? error.stack : '', + owner: ctx.owner, }, }; ctx.response.body = await mustache().renderView(view); diff --git a/packages/server/src/views/index/error.mustache b/packages/server/src/views/index/error.mustache index c0e84232f..74630390a 100644 --- a/packages/server/src/views/index/error.mustache +++ b/packages/server/src/views/index/error.mustache @@ -6,6 +6,11 @@
{{.}}
{{/stack}} -

Back to the login page

+ {{#owner}} +

Back to home page

+ {{/owner}} + {{^owner}} +

Back to login page

+ {{/owner}} \ No newline at end of file