diff --git a/src/app/channel/components/blacklist.tsx b/src/app/channel/components/blacklist.tsx index 7b2c755e..4911aa4f 100644 --- a/src/app/channel/components/blacklist.tsx +++ b/src/app/channel/components/blacklist.tsx @@ -10,7 +10,7 @@ export default function ChannelBlackList({ blacklist }: { blacklist: any }) { {({ open }) => ( <> diff --git a/src/app/channel/components/createModal.tsx b/src/app/channel/components/createModal.tsx index 3c0da232..f551fba4 100644 --- a/src/app/channel/components/createModal.tsx +++ b/src/app/channel/components/createModal.tsx @@ -10,10 +10,12 @@ import { RelayPool } from 'nostr-relaypool'; import { getEventHash, signEvent } from 'nostr-tools'; import { Fragment, useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; +import { useSWRConfig } from 'swr'; import { navigate } from 'vite-plugin-ssr/client/router'; export default function ChannelCreateModal() { const { account, isError, isLoading } = useActiveAccount(); + const { mutate } = useSWRConfig(); const [isOpen, setIsOpen] = useState(false); const [image, setImage] = useState(DEFAULT_AVATAR); @@ -54,13 +56,15 @@ export default function ChannelCreateModal() { pool.publish(event, WRITEONLY_RELAYS); // insert to database createChannel(event.id, event.pubkey, event.content, event.created_at); + // update channe llist + mutate('channels'); // reset form reset(); setTimeout(() => { // close modal setIsOpen(false); // redirect to channel page - navigate(`/channel?id=${event.id}`); + navigate(`/app/channel?id=${event.id}`); }, 2000); } else { console.log('error'); @@ -204,7 +208,7 @@ export default function ChannelCreateModal() {