2018-03-19 06:48:05 +00:00
|
|
|
import Vue from 'vue';
|
2018-04-26 12:08:08 +00:00
|
|
|
import Cookies from 'js-cookie';
|
2018-03-19 06:48:05 +00:00
|
|
|
|
|
|
|
export default new Vue({
|
2018-04-26 12:08:08 +00:00
|
|
|
data() {
|
2018-03-19 06:48:05 +00:00
|
|
|
return {
|
|
|
|
token: null
|
|
|
|
}
|
|
|
|
},
|
2018-04-26 12:08:08 +00:00
|
|
|
|
|
|
|
created()
|
|
|
|
{
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
var cookie = Cookies.get('token');
|
|
|
|
if (typeof cookie !== 'undefined')
|
|
|
|
self.token = cookie;
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
token(newValue)
|
|
|
|
{
|
|
|
|
Cookies.set('token', newValue);
|
|
|
|
}
|
|
|
|
}
|
2018-03-19 06:48:05 +00:00
|
|
|
});
|