Software: Apache. PHP/7.3.33 uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) Safe-mode: OFF (not secure) /var/softaculous/sitepad/editor/site-data/plugins/kkart-pro/packages/kkart-blocks/assets/js/data/ drwxr-xr-x |
Viewing file: Select action/file-type: /** * External dependencies */ import { __ } from '@wordpress/i18n'; import triggerFetch from '@wordpress/api-fetch'; /** * Dispatched a control action for triggering an api fetch call with no parsing. * Typically this would be used in scenarios where headers are needed. * * @param {Object} options The options for the API request. * * @return {Object} The control action descriptor. */ export const apiFetchWithHeaders = ( options ) => { return { type: 'API_FETCH_WITH_HEADERS', options, }; }; /** * Error thrown when JSON cannot be parsed. */ const invalidJsonError = { code: 'invalid_json', message: __( 'The response is not a valid JSON response.', 'kkart' ), }; /** * Default export for registering the controls with the store. * * @return {Object} An object with the controls to register with the store on * the controls property of the registration object. */ export const controls = { API_FETCH_WITH_HEADERS( { options } ) { return new Promise( ( resolve, reject ) => { triggerFetch( { ...options, parse: false } ) .then( ( fetchResponse ) => { fetchResponse .json() .then( ( response ) => { resolve( { response, headers: fetchResponse.headers, } ); triggerFetch.setNonce( fetchResponse.headers ); } ) .catch( () => { reject( invalidJsonError ); } ); } ) .catch( ( errorResponse ) => { if ( typeof errorResponse.json === 'function' ) { // Parse error response before rejecting it. errorResponse .json() .then( ( error ) => { reject( error ); } ) .catch( () => { reject( invalidJsonError ); } ); } else { reject( errorResponse.message ); } } ); } ); }, }; |
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0038 ]-- |