diff --git a/frontend/src/router.js b/frontend/src/router.js index 592bdb3..e87f59e 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -34,7 +34,7 @@ const router = createRouter({ routes, // short for `routes: routes` }) -router.beforeEach((to, from) => { +router.beforeEach((to/*, from*/) => { // instead of having to check every route record with // to.matched.some(record => record.meta.requiresAuth) if (to.meta.requiresAuth && !store.getters.isLoggedIn) { diff --git a/frontend/src/store.js b/frontend/src/store.js index 4344fc8..0a64cf9 100644 --- a/frontend/src/store.js +++ b/frontend/src/store.js @@ -102,16 +102,10 @@ export default createStore({ body: JSON.stringify({username: username, password: password}), credentials: 'omit' }).then(r => r.json()) - if (data.token) { + if (data.token && data.key) { commit('setToken', data.token); commit('setUser', username); - const j = await fetch('/auth/keys/', { - method: 'GET', - headers: {'Authorization': 'Token ' + data.token}, - credentials: 'omit' - }).then(r => r.json()) - const k = j.key - commit('setKey', k) + commit('setKey', data.key); const s = await dispatch('lookupServer', {username}).then(servers => new ServerSet(servers, state.unreachable_neighbors)) commit('setHomeServers', s) return true;