There is a token in my localstorage. If I delete the token in localstorage then I don't log out. Can you give me an example of how to do this?
created() { if (this.vueToken) { let headers = { Authorization: "Bearer " + localStorage.getItem("vueToken"), }; axios .get("checkLogin", { headers: headers, }) .then((response) => response); }else{ this.$router.push('/login') } },
You must set a condition in the security route, for example, if the token in local storage is empty, push it to local storage. Here is sample code.
},`