mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-19 14:40:26 +08:00
fix(account): re-add token if a new one comes in
This commit is contained in:
parent
c5a80d807d
commit
358b2743e1
1 changed files with 9 additions and 3 deletions
|
@ -101,13 +101,19 @@ class AccountStore extends NylasStore
|
|||
console.error("Returned account data is invalid", json)
|
||||
console.log JSON.stringify(json)
|
||||
throw new Error("Returned account data is invalid")
|
||||
return if @_tokens[json.id]
|
||||
|
||||
@_load()
|
||||
@_tokens[json.id] = json.auth_token
|
||||
|
||||
account = (new Account).fromJSON(json)
|
||||
@_caches = {}
|
||||
@_accounts.push(account)
|
||||
existingIdx = _.findIndex @_accounts, (a) -> a.id is json.id
|
||||
if existingIdx is -1
|
||||
account = (new Account).fromJSON(json)
|
||||
@_accounts.push(account)
|
||||
else
|
||||
account = @_accounts[existingIdx]
|
||||
account.fromJSON(json)
|
||||
|
||||
@_save()
|
||||
|
||||
@_trigger()
|
||||
|
|
Loading…
Reference in a new issue