feat: show contacts from all logged-in accounts in Pro shell
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { IJMAPClient } from '@/lib/jmap/client-interface';
|
||||
|
||||
/**
|
||||
* Tiny indirection used by the calendar and contact stores to look up a
|
||||
* JMAP client by local account ID without importing `auth-store` directly
|
||||
* — that would form a top-level cycle (auth-store already imports the
|
||||
* feature stores to bootstrap them after login).
|
||||
*
|
||||
* `auth-store` registers its `getClientForAccount` on module init via
|
||||
* `setClientLookup`; the feature stores call `getClientByLocalAccountId`
|
||||
* inside their mutations.
|
||||
*/
|
||||
type ClientLookup = (localAccountId: string) => IJMAPClient | undefined;
|
||||
|
||||
let lookup: ClientLookup | null = null;
|
||||
|
||||
export function setClientLookup(fn: ClientLookup): void {
|
||||
lookup = fn;
|
||||
}
|
||||
|
||||
export function getClientByLocalAccountId(localAccountId: string): IJMAPClient | undefined {
|
||||
return lookup ? lookup(localAccountId) : undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user