Skip to content

Commit 42202f4

Browse files
committed
feat: 更新API路径和请求参数,添加VSCode调试配置
1 parent d18919b commit 42202f4

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

.env.development

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
VITE_APP_PORT=3000
33

44
# 代理前缀
5-
VITE_APP_BASE_API=/dev-api
5+
VITE_APP_BASE_API=/api
66

77
# 接口地址
8-
VITE_APP_API_URL=https://api.youlai.tech # 线上
8+
VITE_APP_API_URL=http://localhost:50010/api # 线上
99
# VITE_APP_API_URL=http://localhost:8989 # 本地
1010

1111
# WebSocket 端点(不配置则关闭),线上 ws://api.youlai.tech/ws ,本地 ws://localhost:8989/ws

.vscode/launch.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Launch Edge",
5+
"request": "launch",
6+
"type": "msedge",
7+
"url": "http://localhost:3000",
8+
"webRoot": "${workspaceFolder}",
9+
"sourceMaps": true,
10+
"preLaunchTask": "npm: dev"
11+
}
12+
]
13+
}

src/api/auth/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import request from "@/utils/request";
22

3-
const AUTH_BASE_URL = "/api/v1/auth";
3+
const AUTH_BASE_URL = "/auth";
44

55
const AuthAPI = {
66
/** 登录接口*/
77
login(data: LoginFormData) {
88
const formData = new FormData();
9-
formData.append("username", data.username);
9+
formData.append("account", data.username);
1010
formData.append("password", data.password);
1111
formData.append("captchaKey", data.captchaKey);
1212
formData.append("captchaCode", data.captchaCode);
1313
return request<any, LoginResult>({
14-
url: `${AUTH_BASE_URL}/login`,
14+
url: `${AUTH_BASE_URL}/session`,
1515
method: "post",
1616
data: formData,
17-
headers: {
18-
"Content-Type": "multipart/form-data",
19-
},
17+
// headers: {
18+
// "Content-Type": "multipart/form-data",
19+
// },
2020
});
2121
},
2222

@@ -35,7 +35,7 @@ const AuthAPI = {
3535
/** 注销登录接口 */
3636
logout() {
3737
return request({
38-
url: `${AUTH_BASE_URL}/logout`,
38+
url: `${AUTH_BASE_URL}/session`,
3939
method: "delete",
4040
});
4141
},

src/api/system/menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import request from "@/utils/request";
22
// 菜单基础URL
3-
const MENU_BASE_URL = "/api/v1/menus";
3+
const MENU_BASE_URL = "/usr";
44

55
const MenuAPI = {
66
/**
@@ -12,7 +12,7 @@ const MenuAPI = {
1212
*/
1313
getRoutes() {
1414
return request<any, RouteVO[]>({
15-
url: `${MENU_BASE_URL}/routes`,
15+
url: `${MENU_BASE_URL}/menus/routers`,
1616
method: "get",
1717
});
1818
},

src/api/system/user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import request from "@/utils/request";
22

3-
const USER_BASE_URL = "/api/v1/users";
3+
const USER_BASE_URL = "/usr";
44

55
const UserAPI = {
66
/**
@@ -10,7 +10,7 @@ const UserAPI = {
1010
*/
1111
getInfo() {
1212
return request<any, UserInfo>({
13-
url: `${USER_BASE_URL}/me`,
13+
url: `${USER_BASE_URL}/users/userinfo`,
1414
method: "get",
1515
});
1616
},

src/store/modules/user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export const useUserStore = defineStore("user", () => {
2020
return new Promise<void>((resolve, reject) => {
2121
AuthAPI.login(LoginFormData)
2222
.then((data) => {
23-
const { accessToken, refreshToken } = data;
24-
setAccessToken(accessToken); // eyJhbGciOiJIUzI1NiJ9.xxx.xxx
23+
const { token, refreshToken } = data;
24+
setAccessToken(token); // eyJhbGciOiJIUzI1NiJ9.xxx.xxx
2525
setRefreshToken(refreshToken);
2626
resolve();
2727
})

0 commit comments

Comments
 (0)