Reputation: 719
Here i'm doing the concatination while setting the state.but it's giving the syntax error.i'm obviously a newbie in vue js world.
export default{
data: function(){
return{
http_options:{
headers:{
'"Authorization": "Basic '+ this.$store.state.authorization + '"'
}
},
Module build failed: SyntaxError: Unexpected token (11:42)
http_options:{
headers:{
'"Authorization": "Basic '+ this.$store.state.authorization + '"'
^
}
}
Upvotes: 0
Views: 50
Reputation: 841
Use ES6 Template Strings
headers:{
"Authorization": `Basic ${this.$store.state.authorization}`
}
Upvotes: 0
Reputation: 5067
You have a mismatch of '
and "
. Just use:
headers:{
Authorization: "Basic "+ this.$store.state.authorization
}
of if you need the '
around the this.$store.state.authorization
(which I HIGHLY doubt if you're doing basic auth) then
headers:{
Authorization: "Basic '"+ this.$store.state.authorization + "'"
}
Upvotes: 1