knowyt/client/src/plugins/engine/fetchUserInfo.js

14 lines
288 B
JavaScript
Raw Normal View History

export default async function() {
const { store, $axios } = this.context
try {
const response = await $axios.get('/api/userinfo')
store.commit('engine/setUser', response.data)
} catch(e) {
store.commit('engine/setUser', undefined)
return false
}
return true
}