- add a reload on beta switch

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-18 15:55:23 -05:00
parent 1e78106224
commit 909f6e8eb5
2 changed files with 4 additions and 6 deletions

View File

@@ -47,10 +47,6 @@ export function App({bodyshop, checkUserSession, currentUser, online, setOnline}
const [listenersAdded, setListenersAdded] = useState(false)
const {t} = useTranslation();
// Handle The Beta Switch.
useEffect(() => {
handleBeta();
}, [])
useEffect(() => {
if (!navigator.onLine) {
@@ -58,6 +54,8 @@ export function App({bodyshop, checkUserSession, currentUser, online, setOnline}
}
checkUserSession();
handleBeta();
}, [checkUserSession, setOnline]);
//const b = Grid.useBreakpoint();

View File

@@ -25,13 +25,13 @@ export const handleBeta = () => {
// Beta is enabled, but the current host name does start with beta.
if (isBeta && !currentHostName.startsWith('beta')) {
window.location.href = `${window.location.protocol}//beta.${currentHostName}${window.location.pathname}${window.location.search}${window.location.hash}`;
window.reload();
window.location.reload();
}
// Beta is not enabled, but the current host name does start with beta.
else if (!isBeta && currentHostName.startsWith('beta')) {
window.location.href = `${window.location.protocol}//${currentHostName.replace('beta.', '')}${window.location.pathname}${window.location.search}${window.location.hash}`;
window.reload();
window.location.reload();
}
}
export default handleBeta;