All files / app/guestSignup AccountService.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 233x                     3x   4x     3x 2x   2x   3x  
import { createRequestSender, RequestSender } from '@bigcommerce/request-sender';
 
import { CreatedCustomer, CreatedCustomerResponse } from './CreatedCustomer';
 
export interface CustomerCreateRequestBody {
    confirmPassword: string;
    newsletter: boolean;
    orderId: number;
    password: string;
}
 
export default class AccountService {
    constructor(
        private requestSender: RequestSender = createRequestSender()
    ) { }
 
    create(body: CustomerCreateRequestBody): Promise<CreatedCustomer> {
        return this.requestSender
            .put<CreatedCustomerResponse>('/internalapi/v1/checkout/customer', { body })
            .then(response => response.body.data.customer);
    }
}