Current File : /home/kelaby89/abl.academy/wp-content/plugins/learnpress/assets/src/js/utils/handle-ajax-api.js
const handleAjax = function( url, params, functions ) {
	wp.apiFetch( {
		path: url,
		method: 'POST',
		data: params,
	} ).then( ( res ) => {
		if ( 'function' === typeof functions.success ) {
			functions.success( res );
		}
	} ).catch( ( err ) => {
		if ( 'function' === typeof functions.error ) {
			functions.error( err );
		}
	} ).then( () => {
		if ( 'function' === typeof functions.completed ) {
			functions.completed();
		}
	} );
};

export default handleAjax;
Page not found – Hello World !