import Api from '@/services/Api' export default { login(username, password) { return Api().post('/v1/user/login', {username: username, password: password}); }, setAccessToken(access_token) { localStorage.setItem('access_token', access_token) Api().defaults.headers.common['Authorization'] = `Bearer ${access_token}` }, getTokenFromStorage() { this.setAccessToken(localStorage.getItem("access_token")); }, me() { return Api().get('/v1/user/me') }, logout() { localStorage.removeItem("access_token"); } }