init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { get, post } from '@/utils/request'
|
||||
import type { User } from '@/types/user'
|
||||
|
||||
/** 微信登录参数 */
|
||||
export interface WxLoginParams {
|
||||
/** wx.login 的临时凭证 */
|
||||
code: string
|
||||
}
|
||||
|
||||
/** 绑定手机号参数 */
|
||||
export interface BindPhoneParams {
|
||||
/** wx.getPhoneNumber 授权得到的 code */
|
||||
phoneCode: string
|
||||
}
|
||||
|
||||
/** 登录 / 绑定手机号返回 */
|
||||
export interface AuthResult {
|
||||
token: string
|
||||
user: User
|
||||
}
|
||||
|
||||
/** 微信登录(自动注册):POST /mini/auth/login */
|
||||
export function wxLoginApi(params: WxLoginParams) {
|
||||
return post<AuthResult>('/mini/auth/login', params)
|
||||
}
|
||||
|
||||
/** 绑定手机号(自动匹配门店/供应商):POST /mini/auth/phone */
|
||||
export function bindPhoneApi(params: BindPhoneParams) {
|
||||
return post<AuthResult>('/mini/auth/phone', params)
|
||||
}
|
||||
|
||||
/** 当前用户信息(含门店客户等级):GET /mini/auth/info */
|
||||
export function getUserInfoApi() {
|
||||
return get<User>('/mini/auth/info')
|
||||
}
|
||||
Reference in New Issue
Block a user