Commit 82413b58 authored by rocosen's avatar rocosen

1

1
parent ef2c151e
...@@ -78,9 +78,11 @@ ...@@ -78,9 +78,11 @@
"workbox-webpack-plugin": "^6.4.1" "workbox-webpack-plugin": "^6.4.1"
}, },
"scripts": { "scripts": {
"dev": "set \"REACT_APP_PROXY=http://47.57.4.97\" && npm start", "start:master": "set \"REACT_APP_ENV=master\" && npm start",
"relrese-cn": "set \"REACT_APP_PROXY=http://47.75.104.171\" && npm start", "start:dev-cn": "set \"REACT_APP_ENV=dev-cn\" && npm start",
"relrese-en": "set \"REACT_APP_PROXY=http://47.57.235.86\" && npm start", "start:dev-en": "set \"REACT_APP_ENV=dev-en\" && npm start",
"start:release-cn": "set \"REACT_APP_ENV=release-cn\" && npm start",
"start:release-en": "set \"REACT_APP_ENV=release-en\" && npm start",
"start": "node scripts/start.js", "start": "node scripts/start.js",
"build": "node scripts/build.js", "build": "node scripts/build.js",
"test": "node scripts/test.js" "test": "node scripts/test.js"
......
import { BACKEND_API_URI_PREFIX } from './api_prefix'
const RESTAPI = {
API_USER_FETCH: `${BACKEND_API_URI_PREFIX}/accounts/current`,
}
export default RESTAPI
\ No newline at end of file
// const AWSPREFIX = "/0xaws";
// const PRIVATIZATIONPREFIX = "/fileserver"
// const PRIVATIZATION_API_URI_PREFIX = process.env.NODE_ENV === 'development' ? "http://123.57.131.31" : "";
let BACKEND_API_URI_PREFIX = "";
console.log('process.env.REACT_APP_ENV: ', process.env.REACT_APP_ENV)
switch (process.env.REACT_APP_ENV) {
case "dev-cn":
BACKEND_API_URI_PREFIX = "http://47.57.4.97";
break;
case "dev-en":
BACKEND_API_URI_PREFIX = "http://47.75.109.159";
break;
case "release-cn":
BACKEND_API_URI_PREFIX = "http://47.75.104.171";
break;
case "release-en":
BACKEND_API_URI_PREFIX = "http://47.57.235.86";
break;
case "global":
BACKEND_API_URI_PREFIX = "https://www.cloudam.io";
break;
default:
if (['www.bkunyun.com'].includes(window.location.host)) {
BACKEND_API_URI_PREFIX = "https://www.bkunyun.com";
} else {
BACKEND_API_URI_PREFIX = "https://www.cloudam.cn";
}
break;
}
export { BACKEND_API_URI_PREFIX } // 导出放在11行后面,避免发布时被替换
import request from "@/utils/axios/service"; import request from "@/utils/axios/service";
import Api from "./api_manager"
function current() { function current() {
return request({ return request({
url: "/accounts/current", url: Api.API_USER_FETCH,
method: "get", method: "get",
}); });
} }
......
...@@ -19,7 +19,7 @@ const useMyRouter = () => { ...@@ -19,7 +19,7 @@ const useMyRouter = () => {
useEffect(() => { useEffect(() => {
if (userInfo.res && menuInfo.res) { if (userInfo.res && menuInfo.res) {
localStorage.setItem(localStorageKey.TOKEN, JSON.stringify(userInfo.res)); localStorage.setItem(localStorageKey.USER_INFO, JSON.stringify(userInfo.res));
permissionStore.restAddRoutes(); permissionStore.restAddRoutes();
for (let item of menuInfo.res.data) { for (let item of menuInfo.res.data) {
......
...@@ -53,6 +53,7 @@ const useMyRequest = <TData, TParams>( ...@@ -53,6 +53,7 @@ const useMyRequest = <TData, TParams>(
...defaultOptions, ...defaultOptions,
onSuccess: () => {}, onSuccess: () => {},
onError: (data) => { onError: (data) => {
console.log('data: ', data);
Message.error(data.message); Message.error(data.message);
}, },
...options, ...options,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment