79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
import { BaseNetwork } from "./BaseNetwork";
|
|
import { HttpApiUrl, SchedulerDTO as DTO } from "@baekyangdan/core-utils";
|
|
|
|
const AccountApi = HttpApiUrl.Account;
|
|
export class AccountNetwork extends BaseNetwork {
|
|
private baseUrl = AccountApi.base;
|
|
|
|
async checkDuplication(data: DTO.CheckDuplicationRequest) {
|
|
const { type, value } = data;
|
|
|
|
return await this.get<DTO.CheckDuplicationResponse>(
|
|
`${this.baseUrl}${AccountApi.checkDuplication}?type=${type}&value=${value}`
|
|
, {
|
|
authPass: true
|
|
}
|
|
);
|
|
}
|
|
|
|
async sendVerificationCode(data: DTO.SendEmailVerificationCodeRequest) {
|
|
return await this.post<DTO.SendEmailVerificationCodeResponse>(
|
|
`${this.baseUrl}${AccountApi.sendEmailVerificationCode}`
|
|
, data
|
|
, {
|
|
authPass: true
|
|
}
|
|
);
|
|
}
|
|
|
|
async verifyCode(data: DTO.VerifyEmailVerificationCodeRequest) {
|
|
return await this.post<DTO.VerifyEmailVerificationCodeResponse>(
|
|
`${this.baseUrl}${AccountApi.verifyEmailVerificationCode}`
|
|
, data
|
|
, {
|
|
authPass: true
|
|
}
|
|
);
|
|
}
|
|
|
|
async signup(data: DTO.SignupRequest) {
|
|
return await this.post<DTO.SignupResponse>(
|
|
`${this.baseUrl}${AccountApi.signup}`
|
|
, data
|
|
, {
|
|
authPass: true
|
|
}
|
|
);
|
|
}
|
|
|
|
async login(data: DTO.LoginRequest) {
|
|
return await this.post<DTO.LoginResponse>(
|
|
`${this.baseUrl}${AccountApi.login}`
|
|
, data
|
|
, {
|
|
authPass: true
|
|
}
|
|
);
|
|
}
|
|
|
|
async sendPasswordResetCode(data: DTO.SendPasswordResetCodeRequest) {
|
|
return await this.post<DTO.SendPasswordResetCodeResponse>(
|
|
`${this.baseUrl}${AccountApi.sendPasswordResetCode}`,
|
|
data
|
|
);
|
|
}
|
|
|
|
async verifyPasswordResetCode(data: DTO.VerifyPasswordResetCodeRequest) {
|
|
return await this.post<DTO.VerifyPasswordResetCodeResponse>(
|
|
`${this.baseUrl}${AccountApi.verifyPasswordResetCode}`,
|
|
data
|
|
);
|
|
}
|
|
|
|
async resetPassword(data: DTO.ResetPasswordRequest) {
|
|
return await this.post<DTO.ResetPasswordResponse>(
|
|
`${this.baseUrl}${AccountApi.resetPassword}`,
|
|
data
|
|
);
|
|
}
|
|
} |