mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Run eslint autofix
This commit is contained in:
parent
36a13f6500
commit
11105d913b
141 changed files with 14160 additions and 11825 deletions
|
@ -1,24 +1,24 @@
|
|||
import { useState, useEffect } from '@wordpress/element';
|
||||
|
||||
export const useScriptParams = (requestConfig) => {
|
||||
const [data, setData] = useState(null);
|
||||
export const useScriptParams = ( requestConfig ) => {
|
||||
const [ data, setData ] = useState( null );
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const response = await fetch(requestConfig.endpoint);
|
||||
const json = await response.json();
|
||||
if (json.success && json?.data?.url_params) {
|
||||
setData(json.data);
|
||||
} else {
|
||||
setData(false);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setData(false);
|
||||
}
|
||||
})();
|
||||
}, [requestConfig]);
|
||||
useEffect( () => {
|
||||
( async () => {
|
||||
try {
|
||||
const response = await fetch( requestConfig.endpoint );
|
||||
const json = await response.json();
|
||||
if ( json.success && json?.data?.url_params ) {
|
||||
setData( json.data );
|
||||
} else {
|
||||
setData( false );
|
||||
}
|
||||
} catch ( e ) {
|
||||
console.error( e );
|
||||
setData( false );
|
||||
}
|
||||
} )();
|
||||
}, [ requestConfig ] );
|
||||
|
||||
return data;
|
||||
return data;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue