actions/alerts: access properties more carefully

This commit is contained in:
Alex Gleason
2022-06-20 11:52:36 -05:00
parent 6530fcf37b
commit 01b46e249b

View File

@ -38,7 +38,7 @@ function showAlert(
}
const showAlertForError = (error: AxiosError<any>) => (dispatch: React.Dispatch<AnyAction>, _getState: any) => {
if (error.response) {
if (error?.response) {
const { data, status, statusText } = error.response;
if (status === 502) {
@ -52,7 +52,7 @@ const showAlertForError = (error: AxiosError<any>) => (dispatch: React.Dispatch<
let message: string | undefined = statusText;
if (data.error) {
if (data?.error) {
message = data.error;
}