fixed build error

This commit is contained in:
Ren Amamiya
2023-04-11 10:30:53 +07:00
parent b54cd34500
commit 4b582e33f6
18 changed files with 37 additions and 127 deletions

View File

@@ -12,8 +12,8 @@ export default function ChatList() {
const router = useRouter();
const [list, setList] = useState([]);
const [activeAccount]: any = useLocalStorage('activeAccount');
const accountProfile = JSON.parse(activeAccount.metadata);
const [activeAccount]: any = useLocalStorage('activeAccount', {});
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
const openSelfChat = () => {
router.push({
@@ -41,7 +41,7 @@ export default function ChatList() {
>
<div className="relative h-5 w-5 shrink overflow-hidden rounded bg-white">
<ImageWithFallback
src={accountProfile.picture || DEFAULT_AVATAR}
src={profile?.picture || DEFAULT_AVATAR}
alt={activeAccount.pubkey}
fill={true}
className="rounded object-cover"
@@ -49,7 +49,7 @@ export default function ChatList() {
</div>
<div>
<h5 className="text-sm font-medium text-zinc-400">
{accountProfile.display_name || accountProfile.name} <span className="text-zinc-500">(you)</span>
{profile?.display_name || profile?.name} <span className="text-zinc-500">(you)</span>
</h5>
</div>
</div>