import { generate_html_for_form_with_product_dimensions } from './generate_html_for_form_with_product_dimensions';

export const handle_response_data = (
	data: ProductDimensionsData[] | undefined,
	form_wrapper: JQuery<HTMLElement>,
	order_id: string,
	type: string,
): void => {
	if ( Array.isArray( data ) && data.length ) {
		const form = generate_html_for_form_with_product_dimensions( data );
		form.attr( 'data-order_id', order_id );
		form.attr( 'data-type', type );
		form.appendTo( form_wrapper );
	}
};
