Sindbad~EG File Manager
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