Answer the question
In order to leave comments, you need to log in
How to do authentication on vue.js using JSON file?
methods: {
async submitForm(){
const {login, pass} = this
try {
const response = await axios.get("/data.json")
if(response.data[1].login == login){
return (
localStorage.setItem('token', 'token'),
this.$router.push('/search')
)
}else{
alert('пароль или логин не совпадают')
}
} catch (error) {
console.log(error)
}
},
},
Answer the question
In order to leave comments, you need to log in
Cool article on the organization of authorization in Vue.js. Maybe you will find something useful.
"Best practices" authorization for Vue
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question