功能:更新消息中心和 YumiNail 模块
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
export interface SendVerificationCodeRequest {
|
||||
phone: string
|
||||
}
|
||||
|
||||
export interface LoginRequest {
|
||||
account: string
|
||||
password: string
|
||||
rememberMe?: boolean
|
||||
shopId?: string | number
|
||||
}
|
||||
|
||||
export interface PhoneLoginRequest {
|
||||
phone: string
|
||||
verificationCode: string
|
||||
shopId?: string | number
|
||||
}
|
||||
|
||||
export interface RegisterRequest {
|
||||
account: string
|
||||
password: string
|
||||
nickname: string
|
||||
shopId?: string | number
|
||||
phone?: string
|
||||
verificationCode?: string
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
userInfo: UserInfo
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
id: IdType
|
||||
account: string
|
||||
nickname: string
|
||||
avatar?: string
|
||||
signature?: string
|
||||
type?: number
|
||||
shopId?: IdType
|
||||
shopName?: string
|
||||
shopIds?: IdType[]
|
||||
shopNames?: string[]
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
export interface RefreshTokenRequest {
|
||||
refreshToken: string
|
||||
}
|
||||
|
||||
export interface RefreshTokenResponse {
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
}
|
||||
|
||||
export interface ResetPasswordRequest {
|
||||
phone: string
|
||||
verificationCode: string
|
||||
newPassword: string
|
||||
}
|
||||
|
||||
export interface SwitchShopRequest {
|
||||
shopId?: string | number
|
||||
}
|
||||
|
||||
export const authApi = {
|
||||
sendVerificationCode: (data: SendVerificationCodeRequest) => {
|
||||
return api.post('/user/send-verification-code', data)
|
||||
},
|
||||
|
||||
login: (data: LoginRequest) => {
|
||||
return api.post<LoginResponse>('/user/login', data)
|
||||
},
|
||||
|
||||
phoneLogin: (data: PhoneLoginRequest) => {
|
||||
return api.post<LoginResponse>('/user/phone-login', data)
|
||||
},
|
||||
|
||||
adminLogin: (data: LoginRequest) => {
|
||||
return api.post<LoginResponse>('/admin/auth/login', data)
|
||||
},
|
||||
|
||||
register: (data: RegisterRequest) => {
|
||||
return api.post('/user/register', data)
|
||||
},
|
||||
|
||||
refreshToken: (data: RefreshTokenRequest) => {
|
||||
return api.post<RefreshTokenResponse>('/user/refresh-token', data)
|
||||
},
|
||||
|
||||
logout: () => {
|
||||
return api.post('/user/logout')
|
||||
},
|
||||
|
||||
switchShop: (data: SwitchShopRequest) => {
|
||||
return api.post<LoginResponse>('/user/switch-shop', data)
|
||||
},
|
||||
|
||||
getUserInfo: () => {
|
||||
return api.get<UserInfo>('/user/info')
|
||||
},
|
||||
|
||||
resetPasswordByPhone: (data: ResetPasswordRequest) => {
|
||||
return api.post('/user/reset-password-by-phone', data)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user