fix: Check if an API error has data before checking the message (#3427)

This was causing the app to crash with an error. I found this manually
by looking through the obfuscated sources in DevTools. It's a
data-point for #3425 though!
This commit is contained in:
Kyle Carberry
2022-08-09 14:26:18 +00:00
committed by GitHub
parent e1da2b6467
commit 53400c6205
+3
View File
@@ -25,6 +25,9 @@ export type ApiError = AxiosError<ApiErrorResponse> & { response: AxiosResponse<
export const isApiError = (err: any): err is ApiError => {
if (axios.isAxiosError(err)) {
const response = err.response?.data
if (!response) {
return false
}
return (
typeof response.message === "string" &&