diff --git a/.env b/.env index fc9f6d6b..0f6b4139 100644 --- a/.env +++ b/.env @@ -29,6 +29,9 @@ VITE_ROUTER_HISTORY_MODE=history # success code of backend service, when the code is received, the request is successful VITE_SERVICE_SUCCESS_CODE=0000 +# no permission codes of backend service, when the code is received, it will displaying a warning message +VITE_SERVICE_NO_PERMISSION_CODES=4444,4445 + # logout codes of backend service, when the code is received, the user will be logged out and redirected to login page VITE_SERVICE_LOGOUT_CODES=8888,8889 diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index f475d425..616ffa26 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -60,7 +60,8 @@ const local: App.I18n.Schema = { logoutWithModal: 'Pop up modal after request failed and then log out user', logoutWithModalMsg: 'User status is invalid, please log in again', refreshToken: 'The requested token has expired, refresh the token', - tokenExpired: 'The requested token has expired' + tokenExpired: 'The requested token has expired', + noPermission: 'The request has no permission' }, theme: { themeSchema: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 4eb52847..fbeaa033 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -60,7 +60,8 @@ const local: App.I18n.Schema = { logoutWithModal: '请求失败后弹出模态框再登出用户', logoutWithModalMsg: '用户状态失效,请重新登录', refreshToken: '请求的token已过期,刷新token', - tokenExpired: 'token已过期' + tokenExpired: 'token已过期', + noPermission: '无接口访问权限' }, theme: { themeSchema: { diff --git a/src/service/request/index.ts b/src/service/request/index.ts index 24e8526a..83b78edb 100644 --- a/src/service/request/index.ts +++ b/src/service/request/index.ts @@ -50,6 +50,13 @@ export const request = createFlatRequest; diff --git a/src/typings/env.d.ts b/src/typings/env.d.ts index 8000a7e0..dc554c24 100644 --- a/src/typings/env.d.ts +++ b/src/typings/env.d.ts @@ -33,6 +33,14 @@ declare namespace Env { * when the code is received, the request is successful */ readonly VITE_SERVICE_SUCCESS_CODE: string; + /** + * no permission codes of backend service + * + * when the code is received, it will displaying a warning message + * + * use "," to separate multiple codes + */ + readonly VITE_SERVICE_NO_PERMISSION_CODES: string; /** * logout codes of backend service *