mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-30 17:04:20 +08:00
13 lines
460 B
JavaScript
13 lines
460 B
JavaScript
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;
|
|
});
|