diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index dd710989..e02d9fb7 100755 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -158,8 +158,8 @@ const Board = () => { useEffect(() => { - if (subplebbit.roles !== undefined) { - const role = subplebbit.roles[account?.author.address]?.role; + if (subplebbit?.roles !== undefined) { + const role = subplebbit?.roles[account?.author.address]?.role; if (role === 'moderator' || role === 'admin' || role === 'owner') { setIsModerator(true); @@ -167,7 +167,7 @@ const Board = () => { setIsModerator(false); } } - }, [account?.author.address, subplebbit.roles]); + }, [account?.author.address, subplebbit?.roles]); const handleThumbnailClick = (index, type) => { @@ -718,7 +718,7 @@ const Board = () => { selectedStyle={selectedStyle} isOpen={isAdminListOpen} closeModal={() => setIsAdminListOpen(false)} - roles={subplebbit.roles} /> + roles={subplebbit?.roles} /> { [ {window.scrollTo(0, 0)}}>Catalog ] - {subplebbit?.roles[account?.author?.address]?.role === "admin" ? ( + {subplebbit.roles && subplebbit?.roles[account?.author?.address]?.role === "admin" ? ( ) : null} diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx index 583e0565..e737d9f5 100755 --- a/src/components/views/Catalog.jsx +++ b/src/components/views/Catalog.jsx @@ -1260,7 +1260,7 @@ const Catalog = () => { [ {window.scrollTo(0, 0)}}>Return ] - {subplebbit?.roles[account?.author?.address]?.role === "admin" ? ( + {subplebbit.roles && subplebbit?.roles[account?.author?.address]?.role === "admin" ? ( ) : null}