mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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" &&
|
||||
|
||||
Reference in New Issue
Block a user