migrated activeAccount state to rehook

This commit is contained in:
Ren Amamiya
2023-04-11 09:02:39 +07:00
parent 0bfcb10253
commit 4e1dcdc2ce
20 changed files with 72 additions and 85 deletions

View File

@@ -29,20 +29,19 @@ export const ActiveAccount = memo(function ActiveAccount({ user }: { user: any }
const insertFollowsToStorage = useCallback(
async (tags) => {
const { createPleb } = await import('@utils/bindings');
const activeAccount = JSON.parse(localStorage.getItem('activeAccount'));
for (const tag of tags) {
const metadata: any = await fetchMetadata(tag[1], pool, relays);
createPleb({
pleb_id: tag[1] + '-lume' + activeAccount.id.toString(),
pleb_id: tag[1] + '-lume' + user.id.toString(),
pubkey: tag[1],
kind: 0,
metadata: metadata.content,
account_id: activeAccount.id,
account_id: user.id,
}).catch(console.error);
}
},
[pool, relays]
[pool, relays, user.id]
);
useEffect(() => {