30 行
895 B
TypeScript
30 行
895 B
TypeScript
import client from './client'
|
|
|
|
export interface SubAccount {
|
|
id: string
|
|
username: string
|
|
email: string
|
|
nickname: string
|
|
phone?: string
|
|
status: 'ACTIVE' | 'DISABLED'
|
|
createdAt: string
|
|
}
|
|
|
|
export const accountApi = {
|
|
list: () => client.get<{ data: SubAccount[] }>('/sub-accounts'),
|
|
|
|
sendVerifyCode: (email: string) =>
|
|
client.post('/sub-accounts/send-verify-code', null, { params: { email } }),
|
|
|
|
verifyEmail: (email: string, code: string) =>
|
|
client.post('/sub-accounts/verify-email', null, { params: { email, code } }),
|
|
|
|
create: (data: { username: string; password: string; email?: string; nickname: string; phone?: string }) =>
|
|
client.post<{ data: SubAccount }>('/sub-accounts', data),
|
|
|
|
disable: (id: string) => client.delete(`/sub-accounts/${id}`),
|
|
|
|
generatePassword: () =>
|
|
client.get<{ data: { password: string } }>('/sub-accounts/generate-password'),
|
|
}
|