first commit
This commit is contained in:
31
src/api/user.js
Normal file
31
src/api/user.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import axios from "axios";
|
||||
import useApiFetch from "@/composables/useApiFetch";
|
||||
|
||||
// 获取API基础URL(与生产规则一致:VITE_API_URL)
|
||||
const baseURL = import.meta.env.VITE_API_URL;
|
||||
|
||||
// 手机号验证码登录
|
||||
export function mobileCodeLogin(params) {
|
||||
return useApiFetch("/user/mobileCodeLogin").post(params).json();
|
||||
}
|
||||
|
||||
// 统一认证
|
||||
export function unifiedAuth(params) {
|
||||
return useApiFetch("/user/auth").post(params).json();
|
||||
}
|
||||
|
||||
// 绑定手机号
|
||||
export function bindMobile(params) {
|
||||
return useApiFetch("/user/bindMobile").post(params).json();
|
||||
}
|
||||
|
||||
// 注销账号API
|
||||
export function cancelAccount() {
|
||||
return axios({
|
||||
method: "post",
|
||||
url: `${baseURL}/api/user/cancel`,
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user