Skip to content

Commit

Permalink
🐛 Added routing guards to prevent entering Home page in advance
Browse files Browse the repository at this point in the history
  • Loading branch information
kotori-y committed Oct 21, 2021
1 parent 65992dd commit dfba155
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const router = new VueRouter({
name: "home",
meta: {
index: 1
},
beforeEnter: (to, form, next ) => {
if (!localStorage.getItem("phoneNum")) {next({ name: "login" })}
else next()
}
},
{
Expand Down

0 comments on commit dfba155

Please sign in to comment.