File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import { useRecoilState, useRecoilValue } from "recoil";
88import BannerMessages from "./components/BannerMessages" ;
99import NavBar from "./components/navbar" ;
1010import Sidebar from "./components/sidebar" ;
11- import { isMobileState , profileFlagsSelector } from "./data/atoms" ;
11+ import {
12+ isMobileState ,
13+ profileFlagsSelector ,
14+ isLoggedInState ,
15+ } from "./data/atoms" ;
1216
1317const menuItems = [
1418 {
@@ -40,6 +44,7 @@ const menuItems = [
4044
4145export default function App ( { children } ) {
4246 const location = useLocation ( ) ;
47+ const isLoggedIn = useRecoilValue ( isLoggedInState ) ;
4348 const [ _ , setCookie ] = useCookies ( [ "irclickid" ] ) ; // eslint-disable-line
4449
4550 let allMenuItems = menuItems ;
@@ -120,6 +125,15 @@ export default function App({ children }) {
120125 } ) ;
121126 }
122127
128+ if (
129+ ! process . env . REACT_APP_ENABLE_SUBSCRIPTION_MANAGEMENT &&
130+ ! location . pathname . startsWith ( "/app/" ) &&
131+ ! isLoggedIn
132+ ) {
133+ // Redirect to login page if user is not logged in
134+ window . location . href = "/login" ;
135+ }
136+
123137 return (
124138 < div id = "app-container" >
125139 < SnackbarProvider
You can’t perform that action at this time.
0 commit comments