diff --git a/src/containers/List/index.jsx b/src/containers/List/index.jsx index cbe05737..ef3aedb6 100644 --- a/src/containers/List/index.jsx +++ b/src/containers/List/index.jsx @@ -639,7 +639,10 @@ export default class BaseList extends React.Component { // eslint-disable-next-line no-console console.log('fetch list error', e); const { message = '', data, status } = (e || {}).response || e || {}; - if (status === 500) { + if (status === 401) { + const title = t('The session has expired, please log in again.'); + Notify.errorWithDetail(null, title); + } else if (status === 500) { const sysErr = t('System is error, please try again later.'); const title = `${t('Get {name} error.', { name: this.name.toLowerCase(), diff --git a/src/containers/TabDetail/index.jsx b/src/containers/TabDetail/index.jsx index c0bb1f86..829a4e16 100644 --- a/src/containers/TabDetail/index.jsx +++ b/src/containers/TabDetail/index.jsx @@ -266,7 +266,10 @@ export default class DetailBase extends React.Component { // eslint-disable-next-line no-console console.log(e); const { data, status } = (e || {}).response || e || {}; - if (status === 404) { + if (status === 401) { + const title = t('The session has expired, please log in again.'); + Notify.errorWithDetail(null, title); + } else if (status === 404) { this.setState({ notFound: true }); Notify.warn( t('{name} {id} could not be found.', { diff --git a/src/locales/en.json b/src/locales/en.json index b76186b3..ec99f05e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1572,6 +1572,7 @@ "The selected VPC/ subnet does not have IPv6 enabled.": "The selected VPC/ subnet does not have IPv6 enabled.", "The selected network has no subnet": "The selected network has no subnet", "The server {name} is locked. Please unlock first.": "The server {name} is locked. Please unlock first.", + "The session has expired, please log in again.": "The session has expired, please log in again.", "The shelved offloaded instance only supports immediate deletion": "The shelved offloaded instance only supports immediate deletion", "The start source is a template used to create an instance. You can choose an image or a bootable volume.": "The start source is a template used to create an instance. You can choose an image or a bootable volume.", "The starting number must be less than the ending number": "The starting number must be less than the ending number", diff --git a/src/locales/zh.json b/src/locales/zh.json index 67092da9..184cdc20 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -1572,6 +1572,7 @@ "The selected VPC/ subnet does not have IPv6 enabled.": "所选的VPC/子网未开通IPv6", "The selected network has no subnet": "选择的网络没有子网", "The server {name} is locked. Please unlock first.": "云主机{name}已被锁定,请先解锁。", + "The session has expired, please log in again.": "会话已过期,请重新登录。", "The shelved offloaded instance only supports immediate deletion": "已归档的云主机仅支持立即删除", "The start source is a template used to create an instance. You can choose an image or a bootable volume.": "启动源是用来创建云主机的模板, 您可以选择镜像或者可启动的卷。", "The starting number must be less than the ending number": "起始数字必须小于结束数字",