не работает кнопка удаления загруженной фотографии React

пожалуйста, помогите разобраться, почему не работает кнопка удаления загруженной фотографии?

removeAvatar = (id, avatarType) => () => {
    const { dispatch, token } = this.props;

    dispatch(deleteAvatar(id, avatarType))
      .then(() => {
        this.setState(prevState => ({
          errors: prevState.errors.delete('file'),
        }));
      })
      .then(() => dispatch(initApp(token)));
  };
export const deleteAvatar = (id, avatarType = '') => (dispatch, getState) => {
  const { auth_token } = getState().userInfo;
  const body = new FormData();

  body.append('auth_token', auth_token);
  body.append('id', id);

  dispatch(
    serviceProfileActions[
      `${avatarType === 'logo' ? 'logo' : 'images'}`
    ].delete({ id }),
  );

  return fetch(
    `${API_URL}/service/profile/${
      avatarType === 'logo' ? 'delete-logo/' : 'delete-photo/'
    }`,
    {
      method: 'POST',
      body,
    },
  )
    .then(res => {
      if (res.ok) {
        return res;
      }
      throw new Error('Fetch error');
    })
    .then(res => res.json())
    .then(json => {
      if ('success' in json) {
        return json;
      }
      throw new Error('Fetch error');
    })
    .then(res => {
      if (res.success === 1) {
        // dispatch(initApp(auth_token));
      }
    })
    .catch(() => {});
};
<FileInput
                      uploadFiles={this.uploadFiles}
                      pendingUpload={pendingUpload}
                      fileInputRef={fileInputRef}
                    />
                {!mainPhoto.url && (
                  <ImageSlot
                      image={mainPhoto}
                      removeAvatar={e => this.removeAvatar(e, 'mainPhoto')}
                  />
)}


Ответы (0 шт):