Commit 035cdff9 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

remove header

parent 47bd40b3
......@@ -47,15 +47,9 @@ export default {
try {
const resp = await this.$axios.post('/logout', {
token: this.$auth.$storage.getUniversal('token')
},
{
headers: {
'Content-Type': 'application/json',
accept: 'application/json'
}
})
if (resp.status == '200') {
this.$toast.success('Successfully authenticated', {
this.$toast.success('Logout!', {
duration: 2000
})
this.$router.push('/login')
......
......@@ -115,14 +115,8 @@ export default {
{
email: this.email,
password: this.password,
status: this.status,
},
{
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
}
})
status: this.status
})
localStorage.setItem("token", resp.data.data.bearer_token)
this.$auth.$storage.setUniversal("token", resp.data.data.bearer_token)
this.$auth.$storage.setUniversal("userName", resp.data.data.name)
......@@ -141,6 +135,7 @@ export default {
}
}
}
}
</script>
<style scoped>
.body {
......
export default function ({ $axios }, inject, redirect) {
$axios.onError(error => {
if(error.response.status === 500) {
$axios.onError((error) => {
if (error.response.status === 500) {
redirect('/500')
}
})
$axios.onError(error => {
$axios.onError((error) => {
const code = parseInt(error.response && error.response.status)
if (code === 400) {
redirect('/400')
......@@ -15,11 +15,12 @@ export default function ({ $axios }, inject, redirect) {
const api = $axios.create({
headers: {
common: {
Accept: 'application/json, text/plain, */*'
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json, text/plain, */*'
}
}
})
// Inject to context as $api
inject('api', api)
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment