woocommerce/packages/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/utils.ts
2021-12-10 12:03:04 +00:00

16 lines
477 B
TypeScript

/**
* External dependencies
*/
import { LOGIN_URL } from '@woocommerce/block-settings';
import { getSetting } from '@woocommerce/settings';
export const LOGIN_TO_CHECKOUT_URL = `${ LOGIN_URL }?redirect_to=${ encodeURIComponent(
window.location.href
) }`;
export const isLoginRequired = ( customerId: number ): boolean => {
return ! customerId && ! getSetting( 'checkoutAllowsGuest', false );
};
export const reloadPage = (): void => void window.location.reload( true );