Hi i am working on react and redux single page application and i am facing a issue.
In my App from the admin panel the admin can make the app close and open.Mean if the app is closed from admin side then we will redirect our users to a error page route and if the app is open from the admin panel then we will allow the users to access and view the pages of our app.
but i am facing a issue i am coming from PHP and Laravel Background in their i can just add a middle ware in each of my routes and i can achieve my goal easily.
I have done some research on it and i find out that i will have to create a Higher Order Component for this and call the api when the app starts and will have to store the api result in local storage but if i call the api and store the api result in my local storage and then with in the next 5 mins admin close the restaurant then how i can update my client local storage so that i can restrict the user access from viewing the pages while the app is closed from admin panel.
so that is why i need to send a ajax request before each route to verify if the user can view the page or not.
Can anyone help me out on this issue here how can i achieve my above goal .