Merged in feature/IO-1828-Beta-Updates-To-Test (pull request #1194)

Feature/IO-1828 Beta Updates To Test
This commit is contained in:
Dave Richer
2024-01-18 21:49:33 +00:00
2 changed files with 7 additions and 9 deletions

View File

@@ -54,17 +54,10 @@ export function App({
}) { }) {
const client = useClient(); const client = useClient();
// Handle The Beta Switch.
useEffect(() => {
handleBeta();
}, [])
useEffect(() => { useEffect(() => {
if (!navigator.onLine) { if (!navigator.onLine) {
setOnline(false); setOnline(false);
} }
checkUserSession(); checkUserSession();
}, [checkUserSession, setOnline]); }, [checkUserSession, setOnline]);
@@ -80,6 +73,7 @@ export function App({
window.addEventListener("online", function (e) { window.addEventListener("online", function (e) {
setOnline(true); setOnline(true);
}); });
useEffect(() => { useEffect(() => {
if (currentUser.authorized && bodyshop) { if (currentUser.authorized && bodyshop) {
client.setAttribute("imexshopid", bodyshop.imexshopid); client.setAttribute("imexshopid", bodyshop.imexshopid);
@@ -114,6 +108,8 @@ export function App({
/> />
); );
handleBeta();
return ( return (
<Switch> <Switch>
<Suspense fallback={<LoadingSpinner message="ImEX Online" />}> <Suspense fallback={<LoadingSpinner message="ImEX Online" />}>

View File

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