I am a novice web developer looking to enhance my skills. For my initial project, I decided to incorporate Laravel and Vue. My main objectives are to:
- Implement an auto-logout feature after 3 minutes of user inactivity
- Create an automatic ping to my token at domain.com/api/refresh
In an attempt to achieve this, I wrote a function in my main.js file:
setTimeout(function() {
window.location.href = "domain.com/logout";
}, 30000);
However, the refresh only occurs once when I reload the page. Can anyone provide guidance on how to make it work continuously? Your help is greatly appreciated :)