aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlambadalambda <gitgud@rogerbraun.net>2017-09-13 04:47:03 -0400
committerlambadalambda <gitgud@rogerbraun.net>2017-09-13 04:47:03 -0400
commit7abcb13ec08513ce41d97af13f442a262060ebae (patch)
tree77dd2203597892c38184a98912985cdf56053b49 /src
parentc6b909570a55741320685b46b1e719c5c274b514 (diff)
parent8b4f59e1f76c605e8039809fc10066927d6dd5ad (diff)
Merge branch 'feature/login-with-cookie' into 'develop'
Try logging in with the existing cookie. See merge request !116
Diffstat (limited to 'src')
-rw-r--r--src/lib/persisted_state.js3
-rw-r--r--src/main.js3
-rw-r--r--src/modules/users.js3
3 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js
index 02349e13..09b5e987 100644
--- a/src/lib/persisted_state.js
+++ b/src/lib/persisted_state.js
@@ -51,6 +51,9 @@ export default function createPersistedState ({
merge({}, store.state, savedState)
)
}
+ if (store.state.users.lastLoginName) {
+ store.dispatch('loginUser', {username: store.state.users.lastLoginName, password: 'xxx'})
+ }
loaded = true
} catch (e) {
console.log("Couldn't load state")
diff --git a/src/main.js b/src/main.js
index 8d3a6775..e83e27c5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -38,8 +38,7 @@ const persistedStateOptions = {
'config.autoLoad',
'config.hoverPreview',
'config.muteWords',
- 'statuses.notifications',
- 'users.users'
+ 'users.lastLoginName'
]
}
diff --git a/src/modules/users.js b/src/modules/users.js
index 98ac8f7e..f29cbf98 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -24,10 +24,12 @@ export const mutations = {
set(user, 'muted', muted)
},
setCurrentUser (state, user) {
+ state.lastLoginName = user.screen_name
state.currentUser = merge(state.currentUser || {}, user)
},
clearCurrentUser (state) {
state.currentUser = false
+ state.lastLoginName = false
},
beginLogin (state) {
state.loggingIn = true
@@ -44,6 +46,7 @@ export const mutations = {
}
export const defaultState = {
+ lastLoginName: false,
currentUser: false,
loggingIn: false,
users: [],