diff options
Diffstat (limited to 'src/site/store/auth.js')
| -rw-r--r-- | src/site/store/auth.js | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/site/store/auth.js b/src/site/store/auth.js index 55009ce..69de9ec 100644 --- a/src/site/store/auth.js +++ b/src/site/store/auth.js @@ -1,8 +1,5 @@ -/* eslint-disable no-shadow */ -// only used so I could keep the convention of naming the first param as "state" in mutations const getDefaultState = () => ({ loggedIn: false, - isLoading: false, user: null, token: null, }); @@ -23,18 +20,14 @@ export const actions = { dispatch('alert/set', { text: e.message, error: true }, { root: true }); } }, - async login({ commit, dispatch }, { username, password }) { + async login({ commit }, { username, password }) { commit('loginRequest'); - try { - const data = await this.$axios.$post('auth/login', { username, password }); - this.$axios.setToken(data.token, 'Bearer'); + const data = await this.$axios.$post('auth/login', { username, password }); + this.$axios.setToken(data.token, 'Bearer'); - commit('setToken', data.token); - commit('loginSuccess', { token: data.token, user: data.user }); - } catch (e) { - dispatch('alert/set', { text: e.message, error: true }, { root: true }); - } + commit('setToken', data.token); + commit('loginSuccess', { token: data.token, user: data.user }); }, async fetchCurrentUser({ commit, dispatch }) { try { |