From 57d43d2d7210964a11911213ad8413b5279a2737 Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Tue, 28 Nov 2023 13:14:25 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20Portal=20default=20page?= =?UTF-8?q?=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes GRO-88 Instead of going to the previous page when visiting /#/portal, it will now go to the default page: - Sign up if you are not signed in - Account home if you are signed in Previously, it had the same behaviour, with the difference that it would also go to the previous page if there was any. --- apps/portal/src/App.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/portal/src/App.js b/apps/portal/src/App.js index 669b94eee9..8d8557ce70 100644 --- a/apps/portal/src/App.js +++ b/apps/portal/src/App.js @@ -741,7 +741,11 @@ export default class App extends React.Component { const customOfferRegex = /^offers\/(\w+?)\/?$/; const site = useSite ?? this.state.site ?? {}; - if (customOfferRegex.test(path)) { + if (path === undefined || path === '') { + return { + page: 'default' + }; + } else if (customOfferRegex.test(path)) { return { pageQuery: path }; @@ -822,7 +826,9 @@ export default class App extends React.Component { } }; } - return {}; + return { + page: 'default' + }; } /**Get Accent color from site data*/ @@ -834,7 +840,7 @@ export default class App extends React.Component { /**Get final page set in App context from state data*/ getContextPage({site, page, member}) { /**Set default page based on logged-in status */ - if (!page) { + if (!page || page === 'default') { const loggedOutPage = isInviteOnlySite({site}) ? 'signin' : 'signup'; page = member ? 'accountHome' : loggedOutPage; }