refactor: TS

This commit is contained in:
2023-01-15 19:40:47 +00:00
parent 9cd24e5623
commit c7e42c1f75
43 changed files with 1129 additions and 918 deletions

18
src/feed/ProfileFeed.ts Normal file
View File

@ -0,0 +1,18 @@
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { HexKey } from "../nostr";
import { RootState } from "../state/Store";
import { addPubKey, MetadataCache } from "../state/Users";
export default function useProfile(pubKey: HexKey) {
const dispatch = useDispatch();
const user = useSelector<RootState, MetadataCache>(s => s.users.users[pubKey]);
useEffect(() => {
if (pubKey) {
dispatch(addPubKey(pubKey));
}
}, [pubKey]);
return user;
}