kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
actions/alerts: access properties more carefully
rodzic
6530fcf37b
commit
01b46e249b
|
@ -38,7 +38,7 @@ function showAlert(
|
||||||
}
|
}
|
||||||
|
|
||||||
const showAlertForError = (error: AxiosError<any>) => (dispatch: React.Dispatch<AnyAction>, _getState: any) => {
|
const showAlertForError = (error: AxiosError<any>) => (dispatch: React.Dispatch<AnyAction>, _getState: any) => {
|
||||||
if (error.response) {
|
if (error?.response) {
|
||||||
const { data, status, statusText } = error.response;
|
const { data, status, statusText } = error.response;
|
||||||
|
|
||||||
if (status === 502) {
|
if (status === 502) {
|
||||||
|
@ -52,7 +52,7 @@ const showAlertForError = (error: AxiosError<any>) => (dispatch: React.Dispatch<
|
||||||
|
|
||||||
let message: string | undefined = statusText;
|
let message: string | undefined = statusText;
|
||||||
|
|
||||||
if (data.error) {
|
if (data?.error) {
|
||||||
message = data.error;
|
message = data.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue