/* eslint-disable no-console */ import SecureFetchBuilder from "../../../../../common/fetch/SecureFetchBuilder.js"; import { globalEnv } from "../../../../../common/globalEnv.js"; import BaseOtpToUserService from "../BaseOtpToUserService.js"; const client = SecureFetchBuilder .url(`https://${globalEnv.otpIn.host}/`) .logWhenFailed(console.error) .header("authorization", `basic ${Buffer.from(`${globalEnv.otpIn.key}:${globalEnv.otpIn.secret}`).toString("base64")}`); export default class extends BaseOtpToUserService { create({ phone }: { phone: any; }): Promise<{ id: any; }> { return client.post(`/social-mail/user/otp-to-user/create/${phone}`).asJson<{ id}>(); } verify({ id, code }: { id: any; code: any; }): Promise<{ id: any; result: any; }> { return client.post(`/social-mail/user/otp-to-user/verify/${id}`).jsonBody({ code }).asJson<{ id, result }>(); } resend({ id }: { id: any; phone }): Promise<{ id: any; resent: any; }> { return client.post(`/social-mail/user/otp-to-user/resend/${id}`).asJson<{ id, resent}>(); } }