import httpFetch from "@/api/fetch" import { ResultData } from "@/api/typing" import { Login } from "./types" const BASE_PATH = process.env.NEXT_PUBLIC_ENV === "production" ? "http://172.16.103.224:9110" : process.env.NEXT_PUBLIC_ENV === "staging" ? "http://172.16.115.128:9110" : "https://label.softtest.cowarobot.com" // 获取验证码 export const getVerifyCode = (params: { phone: string }) => { return httpFetch>({ url: BASE_PATH + `/api/v1/label_server/login/get_verify_code`, method: "POST", body: JSON.stringify(params), }) } // 账户登录 export const passwdLogin = (params: Login.ReqPasswdLogin) => { return httpFetch({ url: BASE_PATH + `/api/v1/label_server/user/login`, method: "POST", body: JSON.stringify({ ...params, name: params.account || params.phone }), isLogin: true, }) } // 验证码登录 export const verificationLogin = (params: Login.ReqVerificationLogin) => { return httpFetch>({ url: BASE_PATH + `/api/v1/label_server/login/verification`, method: "POST", body: JSON.stringify(params), isLogin: true, }) } // 飞书登录 export const fetchFeishuLogin = (params: Login.ReqFeishuLogin) => { return httpFetch>({ url: BASE_PATH + `/api/v1/label_server/login/feishu`, method: "POST", body: JSON.stringify(params), isLogin: true, }) } // 刷新token // export const refreshKey = (params: { token: string }) => { // return httpFetch>({ // url: BASE_PATH + `/api/v1/label_server/user/refresh_token`, // method: "POST", // data: params, // isRefresh: true, // }) // } export const refreshKey = () => { return httpFetch({ url: BASE_PATH + `/api/v1/label_server/user/refresh_token`, method: "GET", isRefresh: true, }) } // 删除cookie export const deleteCookie = () => { return httpFetch>({ url: `/api/session`, method: "DELETE", isDeleteCookie: true, }) }