stash
This commit is contained in:
parent
5c073c3049
commit
49a063f2a7
2 changed files with 3 additions and 9 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue