allow login without token

if our proxy sends proxy auth headers, lets still try to log in even
though we have no bearer token.
This commit is contained in:
Igor Serebryany 2023-10-06 14:34:12 -07:00
parent 3f7ba82e6a
commit a85ae7467c
No known key found for this signature in database
GPG key ID: 0AF607692FD9EB24

View file

@ -170,17 +170,17 @@ export default {
this.processing = false
},
checkAuth() {
const headers = {}
const token = localStorage.getItem('token')
if (!token) return false
if (token) {
headers.Authorization = `Bearer ${token}`
}
this.processing = true
return this.$axios
.$post('/api/authorize', null, {
headers: {
Authorization: `Bearer ${token}`
}
})
.$post('/api/authorize', null, { headers })
.then((res) => {
this.setUser(res)
this.processing = false
@ -214,11 +214,14 @@ export default {
}
},
async mounted() {
if (localStorage.getItem('token')) {
var userfound = await this.checkAuth()
if (userfound) return // if valid user no need to check status
var userfound = await this.checkAuth()
// if valid user no need to check status
if (userfound) {
return
} else {
this.checkStatus()
}
this.checkStatus()
}
}
</script>