Created
April 8, 2018 21:33
-
-
Save diegommarino/249b366a3f7b8684dc467e8ffb83be00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<app-header/> | |
<bootstrap-alert v-if="appAlert" :message="appAlert.message" :type="appAlert.type" :dismissable="appAlert.dismissable"/> | |
<div id="router-content"> | |
<router-view/> | |
</div> | |
</div> | |
</template> | |
<script> | |
import Header from '@/components/header/Header.vue' | |
import BootstrapAlert from '@/components/alert_messages/bootstrap-alert.vue' | |
import axios from 'axios' | |
export default { | |
name: 'App', | |
components: { | |
'app-header': Header, | |
'bootstrap-alert': BootstrapAlert | |
}, | |
computed: { | |
appAlert () { | |
return this.$store.getters.appAlert | |
} | |
}, | |
created () { | |
if (this.$store.getters.isAuthenticated) { | |
axios.defaults.headers.common['Authorization'] = 'Token ' + this.$store.getters.token | |
} else { | |
delete axios.defaults.headers.common['Authorization'] | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment