Preparations for #1689

This commit is contained in:
the-djmaze 2024-08-06 12:19:17 +02:00
parent d2f3aa1c10
commit 166b790a3e
4 changed files with 18 additions and 11 deletions

View file

@ -1,5 +1,13 @@
import { koArrayWithDestroy } from 'External/ko';
import { koComputable } from 'External/ko';
import { isArray } from 'Common/Utils';
export const IdentityUserStore = koArrayWithDestroy();
IdentityUserStore.loading = ko.observable(false).extend({ debounce: 100 });
/** Returns main (login) identity */
IdentityUserStore.main = koComputable(() => {
const list = IdentityUserStore();
return isArray(list) ? list.find(item => item && !item.id()) : null;
});