diff options
author | 2024-08-27 12:39:26 +0200 | |
---|---|---|
committer | 2024-08-27 12:39:26 +0200 | |
commit | 1f3dfbf10c9d3cb88be4e2ee56c8a4c71d805066 (patch) | |
tree | 56c56483d57c84a2c19c47d2df5dc36285202e5c /web/source | |
parent | [chore/frontend] Present themes as dropdown instead of radio (#3244) (diff) | |
download | gotosocial-1f3dfbf10c9d3cb88be4e2ee56c8a4c71d805066.tar.xz |
[bugfix/frontend] Fix `TypeError: gtsError is undefined` (#3245)
Diffstat (limited to 'web/source')
-rw-r--r-- | web/source/settings/components/error.tsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/web/source/settings/components/error.tsx b/web/source/settings/components/error.tsx index a2b4772dc..977cf06c8 100644 --- a/web/source/settings/components/error.tsx +++ b/web/source/settings/components/error.tsx @@ -79,10 +79,15 @@ function Error({ error, reset }: ErrorProps) { let message: ReactNode; if ("status" in error) { - // RTK Query error with data. - const gtsError = error.data as GtsError; - const errMsg = gtsError.error_description ?? gtsError.error; - message = <>Code {error.status} {errMsg}</>; + if (typeof error.status === "number") { + // Error containing GTS API error data. + const gtsError = error.data as GtsError; + const errMsg = gtsError.error_description ?? gtsError.error; + message = <>Code {error.status}: {errMsg}</>; + } else { + // RTK Query fetching / parsing / timeout error. + message = <>{error.status}: {error.error}</>; + } } else { // SerializedError or Error. const errMsg = error.message ?? JSON.stringify(error); |