From 49a063f2a7304b92198df1f38c173cfdf2f097aa Mon Sep 17 00:00:00 2001 From: jedi Date: Wed, 7 Jun 2023 04:52:49 +0200 Subject: [PATCH] stash --- frontend/src/router.js | 2 +- frontend/src/store.js | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) 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;