File "use-poster-image.js"

Full Path: /home/warrior1/public_html/plugins/jetpack/jetpack_vendor/automattic/jetpack-videopress/src/client/hooks/use-poster-image.js
File size: 444 bytes
MIME-type: text/x-java
Charset: utf-8

import apiFetch from '@wordpress/api-fetch';

const usePosterImage = guid => {
	const posterImage = () => {
		return new Promise( function ( resolve, reject ) {
			apiFetch( {
				path: `/wpcom/v2/videopress/${ guid }/poster`,
				method: 'GET',
			} )
				.then( function ( res ) {
					resolve( res );
				} )
				.catch( function ( error ) {
					reject( error );
				} );
		} );
	};

	return posterImage;
};

export default usePosterImage;