Sindbad~EG File Manager

Current Path : /home/escuelai/public_html/wp-content/plugins/learnpress/assets/src/js/utils/
Upload File :
Current File : /home/escuelai/public_html/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;

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists