| @@ -1,21 +1,21 @@ | ||
| 1 | -const handleAjax = function( url, params, functions ) { | |
| 2 | - wp.apiFetch( { | |
| 3 | - path: url, | |
| 4 | - method: 'POST', | |
| 5 | - data: params, | |
| 6 | - } ).then( ( res ) => { | |
| 7 | - if ( 'function' === typeof functions.success ) { | |
| 8 | - functions.success( res ); | |
| 9 | - } | |
| 10 | - } ).catch( ( err ) => { | |
| 11 | - if ( 'function' === typeof functions.error ) { | |
| 12 | - functions.error( err ); | |
| 13 | - } | |
| 14 | - } ).then( () => { | |
| 15 | - if ( 'function' === typeof functions.completed ) { | |
| 16 | - functions.completed(); | |
| 17 | - } | |
| 18 | - } ); | |
| 19 | -}; | |
| 20 | - | |
| 21 | -export default handleAjax; | |
| 1 | +const handleAjax = function( url, params, functions ) { | |
| 2 | + wp.apiFetch( { | |
| 3 | + path: url, | |
| 4 | + method: 'POST', | |
| 5 | + data: params, | |
| 6 | + } ).then( ( res ) => { | |
| 7 | + if ( 'function' === typeof functions.success ) { | |
| 8 | + functions.success( res ); | |
| 9 | + } | |
| 10 | + } ).catch( ( err ) => { | |
| 11 | + if ( 'function' === typeof functions.error ) { | |
| 12 | + functions.error( err ); | |
| 13 | + } | |
| 14 | + } ).then( () => { | |
| 15 | + if ( 'function' === typeof functions.completed ) { | |
| 16 | + functions.completed(); | |
| 17 | + } | |
| 18 | + } ); | |
| 19 | +}; | |
| 20 | + | |
| 21 | +export default handleAjax; | |