0π
β
this
in logout function is not Vue instance You should use arrow function for that:
logout: function () {
axios({
method: 'post',
url: 'logout',
baseURL: this.baseurl
})
.then(response => {
console.log(`post logout: ${JSON.stringify(response)}`)
this.user = null
this.authd = !this.authd
console.log(`logout: authorised is ${this.authd}`)
console.log(`logout: user is ${this.user}`)
})
.catch(function (error) {
console.log("logout has gone wrong" + error)
})
},
Source:stackexchange.com