fixup for delete button changes

This commit is contained in:
Bruno Windels 2019-10-12 22:18:08 +02:00
parent 2fa5fa7890
commit 3ba20dece1

View file

@ -41,8 +41,8 @@ class SessionItemViewModel extends EventEmitter {
return this._sessionInfo.userId; return this._sessionInfo.userId;
} }
get lastUsed() { get sessionInfo() {
return this._sessionInfo.lastUsed; return this._sessionInfo;
} }
} }
@ -51,7 +51,7 @@ export default class SessionPickerViewModel {
this._storageFactory = storageFactory; this._storageFactory = storageFactory;
this._sessionStore = sessionStore; this._sessionStore = sessionStore;
this._sessionCallback = sessionCallback; this._sessionCallback = sessionCallback;
this._sessions = new SortedArray((s1, s2) => (s1.lastUsed || 0) - (s2.lastUsed || 0)); this._sessions = new SortedArray((s1, s2) => (s1.sessionInfo.lastUsed || 0) - (s2.sessionInfo.lastUsed || 0));
} }
async load() { async load() {
@ -60,9 +60,9 @@ export default class SessionPickerViewModel {
} }
pick(id) { pick(id) {
const session = this._sessions.array.find(s => s.id === id); const sessionVM = this._sessions.array.find(s => s.id === id);
if (session) { if (sessionVM) {
this._sessionCallback(session); this._sessionCallback(sessionVM.sessionInfo);
} }
} }