blob: 3a8eb17011e2698ec86923e0b1137437bce39ab1 [file] [log] [blame]
2230102371ee1c92025-06-05 16:18:32 +08001import axios from 'axios';
22301014bc4616f2025-06-03 16:59:44 +08002
3
2230102371ee1c92025-06-05 16:18:32 +08004 class authAPI {
5
6 // static getUserById(userId) {
7 // // 例如 GET http://localhost:8080/123
8 // return axios.get(`/${userId}`);
9 // }
10
11
12 // static updateUser(userId, data) {
13 // // 例如 PUT http://localhost:8080/123 Body: { username: 'xxx', ... }
14 // return axios.put(`/${userId}`, data);
15 // }
16 //
17 //
18 // static deleteUser(userId:string) {
19 // // 例如 DELETE http://localhost:8080/123
20 // return axios.delete(`/${userId}`);
21 // }
22
23
24 static sendVerificationCode(email: string) {
25 // Body: { email: 'xxx@yyy.com'}
26 return axios.post('/api/sendVerification', { email });
27 }
28
29
30 static sendResetCode(email: string) {
31 // Body: { email: 'xxx@yyy.com' }
32 return axios.post('/api/sendResetCode', { email });
33 }
34
35 //
36 // static resetPassword({ email, code, newPassword }) {
37 // // Body: { email, code, newPassword }
38 // return axios.post('/resetPassword', { email, code, newPassword });
39 // }
40 //
41 //
42 // static register({ username, email, verificationCode, password }) {
43 // // Body: { username, email, verificationCode, password, identificationNumber? }
44 // const body = {
45 // username,
46 // email,
47 // verificationCode,
48 // password,
49 // };
50 // return axios.post('/register', body);
51 // }
52 //
53 // /**
54 // * 刷新 JWT Token(POST /refreshToken)
55 // * @param {string} oldToken 旧的 JWT(放在 header: token)
56 // * @returns {Promise<AxiosResponse>}
57 // */
58 // static refreshToken(oldToken : string) {
59 // // 因为后端是从 header 中读取旧 token,这里直接把 token 放进 headers
60 // return axios.post(
61 // '/refreshToken',
62 // {}, // 请求体空
63 // {
64 // headers: {
65 // token: oldToken,
66 // },
67 // }
68 // );
69 // }
70 //
71 //
72 // static login({ email, password } : {email: string, password:string}) {
73 // // Body: { email, password }
74 // return axios.post('/login', { email, password });
75 // }
76
77}
78
79export default authAPI;
22301014bc4616f2025-06-03 16:59:44 +080080