From 8788c7a2e54d4ca59fee8a6a1188d6a2f672c2c9 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Wed, 25 Aug 2021 16:39:46 +0800 Subject: [PATCH] fix: Fix notify with promise reject 1. Fix notify with promise reject 2. Fix constants module import Change-Id: I36d70c9421b1df26a379d692490a64f82654ea12 --- src/containers/List/index.jsx | 2 +- src/containers/TabDetail/index.jsx | 2 +- src/libs/axios.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/containers/List/index.jsx b/src/containers/List/index.jsx index 6fb505b4..b90a534d 100644 --- a/src/containers/List/index.jsx +++ b/src/containers/List/index.jsx @@ -515,7 +515,7 @@ export default class BaseList extends React.Component { } catch (e) { // eslint-disable-next-line no-console console.log('fetch list error', e); - const { message = '', data, status } = e.response || e || {}; + const { message = '', data, status } = (e || {}).response || e || {}; if (status === 500) { const sysErr = t('System is error, please try again later.'); const title = `${t('Get {name} error.', { diff --git a/src/containers/TabDetail/index.jsx b/src/containers/TabDetail/index.jsx index 60e942eb..34e593a4 100644 --- a/src/containers/TabDetail/index.jsx +++ b/src/containers/TabDetail/index.jsx @@ -245,7 +245,7 @@ export default class DetailBase extends React.Component { catch = (e) => { // eslint-disable-next-line no-console console.log(e); - const { data, status } = e.response || e || {}; + const { data, status } = (e || {}).response || e || {}; if (status === 404) { this.setState({ notFound: true }); Notify.warn( diff --git a/src/libs/axios.js b/src/libs/axios.js index 0eaf4e90..2625c5fc 100644 --- a/src/libs/axios.js +++ b/src/libs/axios.js @@ -14,7 +14,7 @@ import Axios from 'axios'; import { getLocalStorageItem } from 'utils/local-storage'; -import { getOpenstackApiVersion } from 'utils/constants'; +import { getOpenstackApiVersion } from 'client/client/constants'; import Notify from 'components/Notify'; import { isEqual } from 'lodash'; import baseURL from './base-url';