mardi 22 mai 2018

Vue.js How to use localstorage in single file component vue

I'm new to Vue.js and i need to know how to use localstorage in login page. And after i successfully logged in to welcome page, If i change the url from '/welcome' to '/login' manually, it is redirecting back to login page because im not using local storage. How to resolve this with localstorage.

Here is the code: `methods: { login() { if(this.input.username != '' && this.input.password != '') {

  this.$http.post('http://www.example.com/test', {name:this.input.username, password:this.input.password})
    .then((response) => { this.items=response.data; 
                    if(this.items =='You are authorised') 
                    this.$router.push('/welcome') 
                    })
                    }

},mounted() {

    this.login()

    }'



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GDAQQZ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire