diff options
author | 2024-10-21 14:04:50 +0200 | |
---|---|---|
committer | 2024-10-21 14:04:50 +0200 | |
commit | 8a93300ac43ffd70ca687d71ee8eefdb755e6a58 (patch) | |
tree | 4f091a3e8ad082738f65f5ab47a1be910bc94933 /web/source/settings/components/user-logout-card.tsx | |
parent | [chore]: Bump github.com/prometheus/client_golang from 1.20.4 to 1.20.5 (#3469) (diff) | |
download | gotosocial-8a93300ac43ffd70ca687d71ee8eefdb755e6a58.tar.xz |
[feature] Add image descriptions for default avatar + header; don't allow editing default desc (#3473)v0.17.1
Diffstat (limited to 'web/source/settings/components/user-logout-card.tsx')
-rw-r--r-- | web/source/settings/components/user-logout-card.tsx | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/web/source/settings/components/user-logout-card.tsx b/web/source/settings/components/user-logout-card.tsx index f8eeaf63c..f9acc9698 100644 --- a/web/source/settings/components/user-logout-card.tsx +++ b/web/source/settings/components/user-logout-card.tsx @@ -19,6 +19,7 @@ import React from "react"; import Loading from "./loading"; +import { Error as ErrorC } from "./error"; import { useVerifyCredentialsQuery, useLogoutMutation } from "../lib/query/oauth"; import { useInstanceV1Query } from "../lib/query/gts-api"; @@ -29,16 +30,20 @@ export default function UserLogoutCard() { if (isLoading) { return <Loading />; - } else { - return ( - <div className="account-card"> - <img className="avatar" src={profile.avatar} alt="" /> - <h3 className="text-cutoff">{profile.display_name?.length > 0 ? profile.display_name : profile.acct}</h3> - <span className="text-cutoff">@{profile.username}@{instance?.account_domain}</span> - <a onClick={logoutQuery} href="#" aria-label="Log out" title="Log out" className="logout"> - <i className="fa fa-fw fa-sign-out" aria-hidden="true" /> - </a> - </div> - ); } + + if (!profile) { + return <ErrorC error={new Error("account was undefined")} />; + } + + return ( + <div className="account-card"> + <img className="avatar" src={profile.avatar} alt="" /> + <h3 className="text-cutoff">{profile.display_name?.length > 0 ? profile.display_name : profile.acct}</h3> + <span className="text-cutoff">@{profile.username}@{instance?.account_domain}</span> + <a onClick={logoutQuery} href="#" aria-label="Log out" title="Log out" className="logout"> + <i className="fa fa-fw fa-sign-out" aria-hidden="true" /> + </a> + </div> + ); }
\ No newline at end of file |