Merge branch 'feature/login-with-cookie' into 'develop'

Try logging in with the existing cookie.

See merge request !116
This commit is contained in:
lambadalambda 2017-09-13 04:47:03 -04:00
commit 7abcb13ec0
3 changed files with 7 additions and 2 deletions

View file

@ -51,6 +51,9 @@ export default function createPersistedState ({
merge({}, store.state, savedState) merge({}, store.state, savedState)
) )
} }
if (store.state.users.lastLoginName) {
store.dispatch('loginUser', {username: store.state.users.lastLoginName, password: 'xxx'})
}
loaded = true loaded = true
} catch (e) { } catch (e) {
console.log("Couldn't load state") console.log("Couldn't load state")

View file

@ -38,8 +38,7 @@ const persistedStateOptions = {
'config.autoLoad', 'config.autoLoad',
'config.hoverPreview', 'config.hoverPreview',
'config.muteWords', 'config.muteWords',
'statuses.notifications', 'users.lastLoginName'
'users.users'
] ]
} }

View file

@ -24,10 +24,12 @@ export const mutations = {
set(user, 'muted', muted) set(user, 'muted', muted)
}, },
setCurrentUser (state, user) { setCurrentUser (state, user) {
state.lastLoginName = user.screen_name
state.currentUser = merge(state.currentUser || {}, user) state.currentUser = merge(state.currentUser || {}, user)
}, },
clearCurrentUser (state) { clearCurrentUser (state) {
state.currentUser = false state.currentUser = false
state.lastLoginName = false
}, },
beginLogin (state) { beginLogin (state) {
state.loggingIn = true state.loggingIn = true
@ -44,6 +46,7 @@ export const mutations = {
} }
export const defaultState = { export const defaultState = {
lastLoginName: false,
currentUser: false, currentUser: false,
loggingIn: false, loggingIn: false,
users: [], users: [],