完成JC-ArtList与JC-Salon端侧清理和统一命名
This commit is contained in:
@@ -0,0 +1,251 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
/**
|
||||
* Purpose: SendVerificationCodeRequest supports auth.ts by holding or executing the send verification code request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface SendVerificationCodeRequest {
|
||||
phone: string
|
||||
sceneCode?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: LoginRequest supports auth.ts by holding or executing the login request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface LoginRequest {
|
||||
account: string
|
||||
password: string
|
||||
rememberMe?: boolean
|
||||
shopId?: string | number
|
||||
agreementAccepted?: boolean
|
||||
agreementVersions?: Record<string, string>
|
||||
clientType?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: PhoneLoginRequest supports auth.ts by holding or executing the phone login request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface PhoneLoginRequest {
|
||||
phone: string
|
||||
verificationCode: string
|
||||
shopId?: string | number
|
||||
agreementAccepted?: boolean
|
||||
agreementVersions?: Record<string, string>
|
||||
clientType?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: RegisterRequest supports auth.ts by holding or executing the register request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface RegisterRequest {
|
||||
account: string
|
||||
password: string
|
||||
nickname: string
|
||||
shopId?: string | number
|
||||
inviteCode?: string
|
||||
phone?: string
|
||||
verificationCode?: string
|
||||
agreementAccepted?: boolean
|
||||
agreementVersions?: Record<string, string>
|
||||
clientType?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: LegalAgreement supports auth.ts by holding or executing the legal agreement page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface LegalAgreement {
|
||||
id: IdType
|
||||
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
|
||||
agreementTypeName: string
|
||||
title: string
|
||||
version: string
|
||||
content: string
|
||||
status: number
|
||||
statusText?: string
|
||||
effectiveTime?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: LoginResponse supports auth.ts by holding or executing the login response page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface LoginResponse {
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
userInfo: UserInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: UserInfo supports auth.ts by holding or executing the user info page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface UserInfo {
|
||||
id: IdType
|
||||
account: string
|
||||
nickname: string
|
||||
avatar?: string
|
||||
signature?: string
|
||||
type?: number
|
||||
shopId?: IdType
|
||||
shopName?: string
|
||||
shopAuthorizationExpireTime?: string
|
||||
shopAuthorizationExpired?: boolean
|
||||
shopIds?: IdType[]
|
||||
shopNames?: string[]
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: RefreshTokenRequest supports auth.ts by holding or executing the refresh token request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface RefreshTokenRequest {
|
||||
refreshToken: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: RefreshTokenResponse supports auth.ts by holding or executing the refresh token response page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface RefreshTokenResponse {
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: ResetPasswordRequest supports auth.ts by holding or executing the reset password request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface ResetPasswordRequest {
|
||||
phone: string
|
||||
verificationCode: string
|
||||
newPassword: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: SwitchShopRequest supports auth.ts by holding or executing the switch shop request page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface SwitchShopRequest {
|
||||
shopId?: string | number
|
||||
}
|
||||
|
||||
/**
|
||||
* authApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const authApi = {
|
||||
/**
|
||||
* `sendVerificationCode` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: SendVerificationCodeRequest caller-supplied value for `data: SendVerificationCodeRequest`
|
||||
*/
|
||||
sendVerificationCode: (data: SendVerificationCodeRequest) => {
|
||||
return api.post('/user/send-verification-code', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `login` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: LoginRequest caller-supplied value for `data: LoginRequest`
|
||||
*/
|
||||
login: (data: LoginRequest) => {
|
||||
return api.post<LoginResponse>('/user/login', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `phoneLogin` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: PhoneLoginRequest caller-supplied value for `data: PhoneLoginRequest`
|
||||
*/
|
||||
phoneLogin: (data: PhoneLoginRequest) => {
|
||||
return api.post<LoginResponse>('/user/phone-login', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `adminLogin` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: LoginRequest caller-supplied value for `data: LoginRequest`
|
||||
*/
|
||||
adminLogin: (data: LoginRequest) => {
|
||||
return api.post<LoginResponse>('/admin/auth/login', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `register` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: RegisterRequest caller-supplied value for `data: RegisterRequest`
|
||||
*/
|
||||
register: (data: RegisterRequest) => {
|
||||
return api.post('/user/register', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `refreshToken` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: RefreshTokenRequest caller-supplied value for `data: RefreshTokenRequest`
|
||||
*/
|
||||
refreshToken: (data: RefreshTokenRequest) => {
|
||||
return api.post<RefreshTokenResponse>('/user/refresh-token', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `logout` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
*/
|
||||
logout: () => {
|
||||
return api.post('/user/logout')
|
||||
},
|
||||
|
||||
/**
|
||||
* `switchShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: SwitchShopRequest caller-supplied value for `data: SwitchShopRequest`
|
||||
*/
|
||||
switchShop: (data: SwitchShopRequest) => {
|
||||
return api.post<LoginResponse>('/user/switch-shop', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `getUserInfo` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
*/
|
||||
getUserInfo: () => {
|
||||
return api.get<UserInfo>('/user/info')
|
||||
},
|
||||
|
||||
/**
|
||||
* `resetPasswordByPhone` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: ResetPasswordRequest caller-supplied value for `data: ResetPasswordRequest`
|
||||
*/
|
||||
resetPasswordByPhone: (data: ResetPasswordRequest) => {
|
||||
return api.post('/user/reset-password-by-phone', data)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: legalAgreementApi supports auth.ts by holding or executing the legal agreement api page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export const legalAgreementApi = {
|
||||
listCurrent: () => {
|
||||
return api.get<LegalAgreement[]>('/legal-agreement/current')
|
||||
},
|
||||
getCurrent: (type: 'USER_TERMS' | 'PRIVACY_POLICY') => {
|
||||
return api.get<LegalAgreement>(`/legal-agreement/current/${type}`)
|
||||
},
|
||||
getMyConsent: () => {
|
||||
return api.get<{ consentVersions: Record<string, string> }>('/user/agreement-consent/me')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user