Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// src/store.js
import Vue from 'vue';
export const store = Vue.observable({
accessToken: window.localStorage.getItem('accessToken'),
});
export const getters = {
isLoggedIn() {
return !!store.accessToken;
},
};
export const mutations = {
setToken(token) {
store.accessToken = token;
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment