There is a problem with sessionStorage

  1. users log in and use sessionStorage to save token
  2. when the user logs out, use the clear method to clear, sessionStorage to empty, and router to the landing page
  3. there is a problem. When you click on the previous page of the browser, sessionStorage still exists.

could you tell me how to solve this problem?

Mar.06,2021

see if the code is re-assigned


in the above page, you need to find out whether there are methods such as reassigning, created mounted activated and so on.
but in fact, you have to write a beforeEach judgment in main. If you don't have the value of session, other pages can't go. I'll give you a reference from my project below

.
// token 
router.beforeEach((to, from, next) => {
    
    const TOKEN = window.localStorage.getItem('token');
    //NProgress.start(); 
    if(!TOKEN && !['/loginDemo', '/logindemo', '/login'].includes(to.path)){
        loginHref(next, { path: '/login' });
    } else {
        next();
    }
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48914-5924b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48914-5924b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?