Skip to content

Commit

Permalink
💡 feat: 补充类型说明
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jun 19, 2021
1 parent 8c59710 commit 4d832de
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion packages/user-panel/src/types/IUserLogin.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,62 @@
export namespace IUserLogin {
export type LoginType = 'account' | 'mobile';
/**
* 登录方式
*/
export type LoginType =
/**
* 账号密码登录
*/
| 'account'
/**
* 手机验证码登录
*/
| 'mobile';

export interface LoginStatus {
/**
* 登录状态
*/
status?: 'ok' | 'error';
/**
* 用户登录方式
*/
type?: LoginType;
/**
* 登录的用户类型
*/
currentAuthority?: 'user' | 'guest';
}

/**
* 账号登录参数
*/
export interface AccountLoginParams {
userName: string;
password: string;
}

/**
* 验证码登录参数
*/
export interface MobileLoginParams {
mobile: string;
captcha: string;
}

/**
* 统一登录参数
*/
export interface LoginParams extends AccountLoginParams, MobileLoginParams {}

/**
* 发送登录请求参数
*/
export interface RequestParams extends Partial<LoginParams> {
type: LoginType;
}

/**
* 登录提交按钮方法
*/
export type LoginSubmit = (values: RequestParams) => Promise<void>;
}

0 comments on commit 4d832de

Please sign in to comment.