fix: reset proxy

index
guofei 2024-06-01 14:45:50 +08:00
parent e87316cc50
commit 5b951eb5df
2 changed files with 29 additions and 27 deletions

View File

@ -1,21 +1,23 @@
var BaseUrl = "/api/"; var BaseUrl = "http://api.soyootech.com/";
export async function UserLogin(loginForm) { export async function UserLogin(loginForm) {
try { try {
var response = await fetch(BaseUrl + "SoyooUser/previewlogin", { var response = await fetch(BaseUrl + "SoyooUser/previewlogin", {
body: JSON.stringify({ body: JSON.stringify({
account: loginForm.account, account: loginForm.account,
password: loginForm.password, password: loginForm.password,
}), }),
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
method: "POST", method: "POST",
}); });
var result = await response.json(); var result = await response.json();
result.permissionPages = result.permissionPages.map((permission) => permission.toLowerCase()); result.permissionPages = result.permissionPages.map((permission) =>
return result; permission.toLowerCase()
} catch (error) { );
console.log(error); return result;
return null; } catch (error) {
} console.log(error);
return null;
}
} }

View File

@ -1,12 +1,12 @@
const { createProxyMiddleware } = require("http-proxy-middleware"); const { createProxyMiddleware } = require("http-proxy-middleware");
module.exports = function (app) { module.exports = function (app) {
app.use( // app.use(
"/api", // 这是路径模式 // "/api",
createProxyMiddleware({ // createProxyMiddleware({
target: "https://api.soyootech.com/", // 目标服务器地址 // target: "https://api.soyootech.com/",
changeOrigin: true, // changeOrigin: true,
pathRewrite: { "^/api": "" }, // pathRewrite: { "^/api": "" },
}) // })
); // );
}; };