refactor relay provider

This commit is contained in:
Ren Amamiya
2023-04-24 08:17:26 +07:00
parent f671521356
commit d52410b857
27 changed files with 113 additions and 87 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ import { RelayContext } from '@components/relaysProvider';
import { UserMini } from '@components/user/mini';
import { channelContentAtom, channelReplyAtom } from '@stores/channel';
import { FULL_RELAYS } from '@stores/constants';
import { MESSAGE_RELAYS } from '@stores/constants';
import { dateToUnix } from '@utils/getDate';
@@ -15,7 +15,7 @@ import { getEventHash, signEvent } from 'nostr-tools';
import { useCallback, useContext } from 'react';
export const FormChannel = ({ eventId }: { eventId: string | string[] }) => {
const [pool]: any = useContext(RelayContext);
const pool: any = useContext(RelayContext);
const [activeAccount]: any = useLocalStorage('account', {});
const [value, setValue] = useAtom(channelContentAtom);
@@ -48,7 +48,7 @@ export const FormChannel = ({ eventId }: { eventId: string | string[] }) => {
event.sig = signEvent(event, activeAccount.privkey);
// publish note
pool.publish(event, FULL_RELAYS);
pool.publish(event, MESSAGE_RELAYS);
// reset state
resetValue();
// reset channel reply