💡[FEATURE]: Restrict Navigation
Is your feature request related to a problem? Please describe.
https://github.com/SB2318/UltimateHealth/assets/133581245/136bd381-2348-44ea-81d1-fdcf42721332
Describe the solution you'd like
You have to restrict the navigation, If the user already logged in, or the token has not expired yet, then you have to land the user from SplashScreen to Home page, Otherwise, land the user on the login page.
Additional context Continuation of Login Page Development
Hi @SB2318, please assign this issue to me.
Hi @SB2318, please assign this issue to me.
Please start work with the completion of issue no #55
@Himanshu8850 You can start work.
Hello @SB2318! Your issue #63 has been closed. Thank you for your contribution!
So I have to make login page, then allow user to access home page only if his token is not expired, right?
So I have to make login page, then allow user to access home page only if his token is not expired, right?
- Run the backend server (Follow the instructions given in Readme.md).
- Create an account
- Get the useremail and password.
- Go to frontend folder.
- Install the necessary dependencies.
- Install @react-native-async-storage/async-storage
- Create Util functions to storeItem and retrieveItem
- Open SplashScreen file,
Here you have to make your changes, By default, it is navigating to TabNavigation (HomePage)
You have to create a function which will determine whether the user logged in or not, Try to retrieve user data from local storage( async-storage).
if(null) login-page else homepage
@Himanshu8850 Those are a brief overview of your task, you can also find your solutions. For further doubts, please reach out to me on Discord.
all right i'm on it.
@SB2318 is this good?
https://github.com/SB2318/UltimateHealth/assets/128601673/2179a5b6-8532-4fe4-8781-a8037b75f771
@Himanshu8850 No, please go through the problem statements and instructions.
For your reference:
https://reactnavigation.org/docs/auth-flow/
It's just that onclick login button store function adds user value ok in the storage and then navigates to tabnavigation , where the user value is again checked and now that the value is present it logs in, isn't this what you specified ,further login and sign up are in other issues?
It's just that onclick login button store function adds user value ok in the storage and then navigates to tabnavigation , where the user value is again checked and now that the value is present it logs in, isn't this what you specified ,further login and sign up are in other issues?
Please think first, We will discuss about it tomorrow.
can you please pinpoint what's missing?
can you please pinpoint what's missing?
Let's visualize the thing, Suppose you download an application from Play Store for the first time you have opened it. Then the authentication page comes in front of you, you authenticate yourself then you proceed further.
Generally, those modules are like, LaunchScreen -> Login-> SignUp -> Login (For an unregistered user) LaunchScreen-> Login -> Home (User with an existing account, but somehow they log out themselves) LaunchScreen -> Home (User already logged in, from splash-screen you can get user data in local storage).
For further doubt please maintain the encapsulation strategy and message me on discord, I will available there.
I can't find you can you message me my discord id is himanshu8850.
I can't find you can you message me my discord id is himanshu8850.
Sent, Weather is not good, so you may get late reply
https://discord.com/invite/D3xhDnPj
@Himanshu8850 Sorry, was unavailable for few days due to natural calamity . Please come in the discord server, today we will discuss about your issue.
Hello @SB2318! Your issue #63 has been closed. Thank you for your contribution!