统一甲屿云命名体系
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import { api, adminApi } from '@/api/client'
|
||||
import type { LegalAgreement, LoginResponse, LoginShopSelectionResponse } from '@/types/common'
|
||||
|
||||
export interface PasswordLoginRequest {
|
||||
account: string
|
||||
password: string
|
||||
shopId?: string | number
|
||||
agreementAccepted: boolean
|
||||
agreementVersions: Record<string, string>
|
||||
clientType: string
|
||||
}
|
||||
|
||||
export interface PhoneLoginRequest {
|
||||
phone: string
|
||||
verificationCode: string
|
||||
shopId?: string | number
|
||||
agreementAccepted: boolean
|
||||
agreementVersions: Record<string, string>
|
||||
clientType: string
|
||||
}
|
||||
|
||||
export interface RegisterRequest {
|
||||
account: string
|
||||
password: string
|
||||
nickname: string
|
||||
shopName: string
|
||||
phone: string
|
||||
verificationCode: string
|
||||
agreementAccepted: boolean
|
||||
agreementVersions: Record<string, string>
|
||||
clientType: string
|
||||
}
|
||||
|
||||
export const authApi = {
|
||||
passwordLogin(data: PasswordLoginRequest): Promise<LoginResponse> {
|
||||
return adminApi.post('/auth/login', data)
|
||||
},
|
||||
getPasswordLoginShops(account: string): Promise<LoginShopSelectionResponse> {
|
||||
return adminApi.get(`/auth/login-shops/${encodeURIComponent(account)}`)
|
||||
},
|
||||
sendRegisterCode(phone: string): Promise<boolean> {
|
||||
return api.post('/user/send-verification-code', { phone, sceneCode: 'PLANNING_MANAGER_REGISTER' })
|
||||
},
|
||||
sendLoginCode(phone: string): Promise<boolean> {
|
||||
return api.post('/user/send-verification-code', { phone, sceneCode: 'USER_LOGIN_SMS_CODE' })
|
||||
},
|
||||
phoneLogin(data: PhoneLoginRequest): Promise<LoginResponse> {
|
||||
return api.post('/user/phone-login', data)
|
||||
},
|
||||
getPhoneLoginShops(phone: string): Promise<LoginShopSelectionResponse> {
|
||||
return api.get(`/user/check/login-shops/phone/${encodeURIComponent(phone)}`)
|
||||
},
|
||||
getCurrentAgreements(): Promise<LegalAgreement[]> {
|
||||
return api.get('/legal-agreement/current')
|
||||
},
|
||||
register(data: RegisterRequest): Promise<LoginResponse> {
|
||||
return adminApi.post('/auth/register', data)
|
||||
},
|
||||
switchShop(shopId: string | number): Promise<LoginResponse> {
|
||||
return adminApi.post('/auth/switch-shop', { shopId })
|
||||
},
|
||||
logout(): Promise<boolean> {
|
||||
return adminApi.post('/auth/logout')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user