@selldone/sdk-storefront
Version:
A TypeScript SDK to connect to your shop and build a fully functional storefront and website by simply developing a frontend web application. All backend operations are seamlessly managed by the serverless Selldone solution.
49 lines (48 loc) • 1.47 kB
TypeScript
import { XapiAuthEmail } from "@selldone/sdk-storefront/auth/email/XapiAuthEmail";
/**
* STEP 1.
* Sends a request for an OTP (One-Time Password) to the provided email.
*
* This function constructs the necessary parameters and URL to send a POST request
* to the XAPI endpoint for requesting an OTP. It then sends the request and returns
* the response.
*
* @param this - The XapiAuthEmail instance, bound to the function.
* @param email - The email address to which the OTP should be sent.
* @returns A Promise that resolves to an IResponse object containing the success status and email.
*
* @example
* ```typescript
* requestOTP() {
* this.busy = true;
*
* window.$storefront.auth.email
* .requestOtp(this.email)
* .then(({ success }) => {
* // Success sending OTP
* })
* .catch((error) => {
* console.error(error);
* })
* .finally(() => {
* this.busy = false;
* });
* }
* ```
*/
export default function XapiAuthEmailRequestOtp(this: XapiAuthEmail, email: string): Promise<XapiAuthEmailRequestOtpTypes.IResponse>;
export declare namespace XapiAuthEmailRequestOtpTypes {
/**
* The response returned by the requestOTP function.
*/
interface IResponse {
/**
* Indicates whether the request was successful.
*/
success: boolean;
/**
* The email address to which the OTP was sent.
*/
email: string;
}
}