knowyt/client/src/plugins/engine/fetchUserInfo.js
2021-08-13 00:41:23 +02:00

14 lines
282 B
JavaScript

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