feat: 本次提交更新内容如下
api问题处理
This commit is contained in:
@@ -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<LoginResponse>('/v1/auth/login', { phone, password }, 'POST');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 验证码登录
|
|
||||||
export function loginWithCode(phone: string, verificationCode: string) {
|
|
||||||
return request<LoginResponse>('/v1/auth/login-code', { phone, verificationCode }, 'POST');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送验证码
|
|
||||||
export function sendVerificationCode(phone: string) {
|
|
||||||
return request<SendCodeResponse>('/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');
|
|
||||||
}
|
|
||||||
@@ -7,11 +7,7 @@ import {
|
|||||||
UserOutline,
|
UserOutline,
|
||||||
} from "antd-mobile-icons";
|
} from "antd-mobile-icons";
|
||||||
import { useUserStore } from "@/store/module/user";
|
import { useUserStore } from "@/store/module/user";
|
||||||
import {
|
import { loginWithPassword, loginWithCode, sendVerificationCode } from "./api";
|
||||||
loginWithPassword,
|
|
||||||
loginWithCode,
|
|
||||||
sendVerificationCode,
|
|
||||||
} from "@/api/auth";
|
|
||||||
import style from "./login.module.scss";
|
import style from "./login.module.scss";
|
||||||
|
|
||||||
const Login: React.FC = () => {
|
const Login: React.FC = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user