How to prevent back to homepage after f5/refreshpage from dashboard - reactjs

I have a problem when i creating a web for myself. when i login and go to dashboard. and when some code edited will refresh the page but back to login page again / always logout. this is after i refresh the page in dashboard. my question, how to prevent back to login or prevent logout after refresh the page. this is for react js. thank you, from the newbie

Related

ReactiveSearch (Web): Pagination gets reset once returning to same page

I am working on ReactiveSearch, in which I am using URLParams to maintain search selections of user through route changes.
When on any page other than first, after refreshing browser, user gets on that page,
but once user change the page and visit same page again, by click on pagination, it redirects user to first page rather than that page.
On Sandbox here, if you refresh page after navigating to Page 3, and do navigation by going to Page 2 and again to Page 3, you will be redirected to Page 1.
Is there any work around I can fix this till issue gets fixed?
Thanks.
They have updated their repo now and above issue is resolved.

Prevent back button after logout in angular JS

So there's a login page and let's say a dashboard with certain data fields. When I press logout from the dashboard it redirects me to the login page. But when I hit back button, it brings me back tot he dashboard and technically let's me access data I shouldn't be able to access.
It was solved by refreshing after pressing back button, because it seems that is the page cache loading from memory which needs to be refreshed. But I don't want the user to have to manually refresh.
Any workaround to that, or a completely different solution would be great.
In angular, you can use #hostListner(angular decorator). that is used for handling dom events in angular.
in your project, you can help localStorage and #hostListner
store client information on local storage with javascript.
store local storage
and then in the log-in page
add #hostListner event in component.ts file
event handling
Implement session validation in each of your route $routeChangeStart event. Whenever user loggout clear the session data and redirect it default route which should be your login page.

AngularJs handling browser back button and forward button

I want to create a login page using angularjs and html5 .Now when the I give the credentials in the login page it is directed to a new page using angular routing.When I press the sign out button it will navigate back to the login page.Now when I press the forward browser button without giving the credentials it should not open the same page but it should load some other page like session time out or some error page.How can I handle this using AngularJs?
Don't keep logout and login in routing try following codes-
windows.location.replace=('logout_url')
//Try this if above doesn't work
windows.location=('logout_url')

How to remove/delete or skip a state in angular

I am trying to skip a state after logout in angular ui router SPA. But I am unable to acive this.
dashboard -> login -> view details -> logout -> dashboard
I am logging in dashboard and moving to details state and logging out there. On logout I am moving to dashboard. Now, if I press back button It is again going to view details page. How can I prevent to moving there. Please help me. How can I remove that view details state from history on logout. Of course the history not containing this page bcoz it is SPA. Button I observed them in browser back button long press

Ionic sidemenu login

I am developing an ionic app with firebase login .It has a sidemenu with pages when they click the sidemenu link , i want the user to be redirected automatically to login page if they are not logged in .
Any help would be greatly appreciated
If you are using ionic 1. Write a function in your controller which would check the state of your user. i.e Whether logged in or not and call the function whenever the user clicks on the side links. If logged in then you can do a $state.go('stateName of the link') else you can do a $state.go('your login state name').

Resources