Any object containing similar keys is not the same as the thing we want.

This commit is contained in:
joshaber 2016-05-31 14:38:05 -04:00
parent c9e4b1b629
commit ccaf0aa41f
2 changed files with 5 additions and 5 deletions

View file

@ -49,9 +49,9 @@ export function askUserToAuth(endpoint: string) {
shell.openExternal(getOAuthURL(authState))
}
export function getToken(user: User): string {
const serviceName = getServiceNameForUser(user)
return keytar.getPassword(serviceName, user.getLogin())
export function getToken(login: string, endpoint: string): string {
const serviceName = getServiceNameForUser(new User(login, endpoint, ''))
return keytar.getPassword(serviceName, login)
}
export function setToken(user: User, token: string) {

View file

@ -46,8 +46,8 @@ export default class UsersStore {
return
}
const rawUsers: User[] = JSON.parse(raw)
const usersWithTokens = rawUsers.map(user => user.userWithToken(getToken(user)))
const rawUsers: any[] = JSON.parse(raw)
const usersWithTokens = rawUsers.map(user => new User(user.login, user.endpoint, getToken(user.login, user.endpoint)))
this.users = usersWithTokens
this.usersDidChange()