diff --git a/nkebao/src/api/auth.ts b/nkebao/src/api/auth.ts deleted file mode 100644 index 36b1a82ec..000000000 --- a/nkebao/src/api/auth.ts +++ /dev/null @@ -1,54 +0,0 @@ -import request from './request'; - -export interface LoginParams { - phone: string; - password?: string; - verificationCode?: string; -} - -export interface LoginResponse { - code: number; - msg: string; - data: { - token: string; - token_expired: string; - member: { - id: string; - name: string; - phone: string; - s2_accountId: string; - avatar?: string; - email?: string; - }; - }; -} - -export interface SendCodeResponse { - code: number; - msg: string; -} - -// 密码登录 -export function loginWithPassword(phone: string, password: string) { - return request('/v1/auth/login', { phone, password }, 'POST'); -} - -// 验证码登录 -export function loginWithCode(phone: string, verificationCode: string) { - return request('/v1/auth/login-code', { phone, verificationCode }, 'POST'); -} - -// 发送验证码 -export function sendVerificationCode(phone: string) { - return request('/v1/auth/send-code', { phone }, 'POST'); -} - -// 退出登录 -export function logout() { - return request('/v1/auth/logout', {}, 'POST'); -} - -// 获取用户信息 -export function getUserInfo() { - return request('/v1/auth/user-info', {}, 'GET'); -} \ No newline at end of file diff --git a/nkebao/src/pages/login/login.tsx b/nkebao/src/pages/login/login.tsx index 570bf016e..f38d7dc7e 100644 --- a/nkebao/src/pages/login/login.tsx +++ b/nkebao/src/pages/login/login.tsx @@ -7,11 +7,7 @@ import { UserOutline, } from "antd-mobile-icons"; import { useUserStore } from "@/store/module/user"; -import { - loginWithPassword, - loginWithCode, - sendVerificationCode, -} from "@/api/auth"; +import { loginWithPassword, loginWithCode, sendVerificationCode } from "./api"; import style from "./login.module.scss"; const Login: React.FC = () => {