forked from AkkomaGang/akkoma-fe
Try logging in with the existing cookie.
This commit is contained in:
parent
87b18da811
commit
8b4f59e1f7
3 changed files with 7 additions and 2 deletions
|
@ -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")
|
||||
|
|
|
@ -38,8 +38,7 @@ const persistedStateOptions = {
|
|||
'config.autoLoad',
|
||||
'config.hoverPreview',
|
||||
'config.muteWords',
|
||||
'statuses.notifications',
|
||||
'users.users'
|
||||
'users.lastLoginName'
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -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: [],
|
||||
|
|
Loading…
Reference in a new issue