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,29 +1,29 @@
|
|||
export function log(message, level = 'info') {
|
||||
const wpDebug = window.wc_ppcp_axo?.wp_debug;
|
||||
const endpoint = window.wc_ppcp_axo?.ajax?.frontend_logger?.endpoint;
|
||||
if (!endpoint) {
|
||||
return;
|
||||
}
|
||||
export function log( message, level = 'info' ) {
|
||||
const wpDebug = window.wc_ppcp_axo?.wp_debug;
|
||||
const endpoint = window.wc_ppcp_axo?.ajax?.frontend_logger?.endpoint;
|
||||
if ( ! endpoint ) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(endpoint, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
body: JSON.stringify({
|
||||
nonce: window.wc_ppcp_axo.ajax.frontend_logger.nonce,
|
||||
log: {
|
||||
message,
|
||||
level,
|
||||
}
|
||||
})
|
||||
}).then(() => {
|
||||
if (wpDebug) {
|
||||
switch (level) {
|
||||
case 'error':
|
||||
console.error(`[AXO] ${message}`);
|
||||
break;
|
||||
default:
|
||||
console.log(`[AXO] ${message}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
fetch( endpoint, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
body: JSON.stringify( {
|
||||
nonce: window.wc_ppcp_axo.ajax.frontend_logger.nonce,
|
||||
log: {
|
||||
message,
|
||||
level,
|
||||
},
|
||||
} ),
|
||||
} ).then( () => {
|
||||
if ( wpDebug ) {
|
||||
switch ( level ) {
|
||||
case 'error':
|
||||
console.error( `[AXO] ${ message }` );
|
||||
break;
|
||||
default:
|
||||
console.log( `[AXO] ${ message }` );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue