Recv/public/src/shared.js

26 lines
373 B
JavaScript
Raw Normal View History

2018-03-19 06:48:05 +00:00
import Vue from 'vue';
import Cookies from 'js-cookie';
2018-03-19 06:48:05 +00:00
export default new Vue({
data() {
2018-03-19 06:48:05 +00:00
return {
token: null
}
},
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
});