#Pop up a modal when a user session about to expire
11 messages · Page 1 of 1 (latest)
I dunno exactly what jwt is but if you know how long the expire is you can do a settimeout for that length - some change and make a modal pop up once it reaches the settimeout
yes I know how long it will expire and how will I do the set time out in angular?
Using the standard setTimeout function (https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) , or using RxJS's timer (https://rxjs.dev/api/index/function/timer)
Thank you will take a look into this
Hi, How to make it global? I want to make the code only on a one component and be used by all the component. should I put it in appcomponent? or is there a configuration?
g!toh you should learn about services. This is covered by the tour of heroes tutorial
Hi @jaunty hawk, welcome to 
We recommend you start your Angular journey with the Tour of Heroes tutorial, located here: https://angular.io/tutorial.
Hi jbnizet, I think timer runs globally already. maybe I don't need a service. is it correct?
I mean, if I am in home or any component that timer is still running right? but I have not tried it yet. I am still watching the tutorials. I have to test it if I move to another pages, will the timer resets or will just to continue to run. I am putting the code inside app.component.
Yes, the timer will be global. But if you want to start it or stop it or whatever from anywhere, it should be inside a service.