first commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import request from '@/axios'
|
||||
import type { RegisterUserType, SmsLoginType, UserLoginType, UserType } from './types'
|
||||
|
||||
interface RoleParams {
|
||||
roleName: string
|
||||
}
|
||||
|
||||
export const loginApi = (data: UserLoginType): Promise<IResponse<UserType>> => {
|
||||
return request.post({ url: '/promo/login', data })
|
||||
}
|
||||
|
||||
export const smsLoginApi = (data: SmsLoginType): Promise<IResponse<UserType>> => {
|
||||
return request.post({ url: '/promo/smsLogin', data })
|
||||
}
|
||||
|
||||
export const registerApi = (data: RegisterUserType): Promise<IResponse<UserType>> => {
|
||||
return request.post({ url: '/promo/register', data })
|
||||
}
|
||||
|
||||
export const getCodeApi = (
|
||||
phoneNumber: string,
|
||||
captchaId: string,
|
||||
type: '1' | '2' = '1',
|
||||
parentInvitationCode?: string
|
||||
): Promise<IResponse<UserType>> => {
|
||||
return request.post({
|
||||
url: '/promo/sms/getVerifyCode',
|
||||
data: {
|
||||
phoneNumber: phoneNumber,
|
||||
type,
|
||||
captchaId: captchaId,
|
||||
parentInvitationCode
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const loginOutApi = (): Promise<IResponse> => {
|
||||
return request.get({ url: '/mock/user/loginOut' })
|
||||
}
|
||||
|
||||
export const getUserListApi = ({ params }: AxiosConfig) => {
|
||||
return request.get<{
|
||||
code: string
|
||||
data: {
|
||||
list: UserType[]
|
||||
total: number
|
||||
}
|
||||
}>({ url: '/mock/user/list', params })
|
||||
}
|
||||
|
||||
export const getAdminRoleApi = (
|
||||
params: RoleParams
|
||||
): Promise<IResponse<AppCustomRouteRecordRaw[]>> => {
|
||||
return request.get({ url: '/mock/role/list', params })
|
||||
}
|
||||
|
||||
export const getTestRoleApi = (params: RoleParams): Promise<IResponse<string[]>> => {
|
||||
return request.get({ url: '/mock/role/list2', params })
|
||||
}
|
||||
Reference in New Issue
Block a user