🐛 Fixed Portal default page handling

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.
This commit is contained in:
Simon Backx 2023-11-28 13:14:25 +01:00 committed by Simon Backx
parent 3f70cc08b7
commit 57d43d2d72

View File

@ -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;
}