mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
[bugfix/frontend] Fix TypeError: gtsError is undefined
(#3245)
This commit is contained in:
parent
2db5a51582
commit
1f3dfbf10c
1 changed files with 9 additions and 4 deletions
|
@ -79,10 +79,15 @@ function Error({ error, reset }: ErrorProps) {
|
||||||
|
|
||||||
let message: ReactNode;
|
let message: ReactNode;
|
||||||
if ("status" in error) {
|
if ("status" in error) {
|
||||||
// RTK Query error with data.
|
if (typeof error.status === "number") {
|
||||||
const gtsError = error.data as GtsError;
|
// Error containing GTS API error data.
|
||||||
const errMsg = gtsError.error_description ?? gtsError.error;
|
const gtsError = error.data as GtsError;
|
||||||
message = <>Code {error.status} {errMsg}</>;
|
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 {
|
} else {
|
||||||
// SerializedError or Error.
|
// SerializedError or Error.
|
||||||
const errMsg = error.message ?? JSON.stringify(error);
|
const errMsg = error.message ?? JSON.stringify(error);
|
||||||
|
|
Loading…
Reference in a new issue