From 4b016c908dda2019f3bf89e5a3d2eae535e5fbd2 Mon Sep 17 00:00:00 2001 From: polwex Date: Thu, 18 Sep 2025 00:24:39 +0700 Subject: oioi --- front/src/state/state.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'front/src/state/state.ts') diff --git a/front/src/state/state.ts b/front/src/state/state.ts index 2e747ea..715427d 100644 --- a/front/src/state/state.ts +++ b/front/src/state/state.ts @@ -19,10 +19,11 @@ export type LocalState = { setModal: (modal: JSX.Element | null) => void; composerData: ComposerData | null; setComposerData: (c: ComposerData | null) => void; - key: string; + pubkey: string; nostrFeed: Event[]; relays: Record; profiles: Map; // pubkey key + addProfile: (key: string, u: UserProfile) => void; following: Map; followers: string[]; }; @@ -38,7 +39,7 @@ export const useStore = creator((set, get) => ({ await api.subscribeStore((data) => { console.log("store sub", data); if ("state" in data) { - const { feed, nostr, following, relays, profiles, key } = data.state; + const { feed, nostr, following, relays, profiles, pubkey } = data.state; const flwing = new Map(Object.entries(following as Record)); flwing.set(api!.airlock.our!, feed); set({ @@ -46,7 +47,7 @@ export const useStore = creator((set, get) => ({ nostrFeed: nostr, profiles: new Map(Object.entries(profiles)), following: flwing, - key, + pubkey, }); } else if ("fact" in data) { if ("post" in data.fact) { @@ -65,8 +66,13 @@ export const useStore = creator((set, get) => ({ }); set({ api }); }, - key: "", + pubkey: "", profiles: new Map(), + addProfile: (key, profile) => { + const profiles = get().profiles; + profiles.set(key, profile); + set({ profiles }); + }, relays: {}, nostrFeed: [], following: new Map(), -- cgit v1.2.3