diff --git a/modules/ppcp-settings/resources/js/data/_example/actions.js b/modules/ppcp-settings/resources/js/data/_example/actions.js index b2e805ae5..f9cd9a556 100644 --- a/modules/ppcp-settings/resources/js/data/_example/actions.js +++ b/modules/ppcp-settings/resources/js/data/_example/actions.js @@ -75,16 +75,10 @@ export const setIsReady = ( isReady ) => setTransient( 'isReady', isReady ); */ export function persist() { return async ( { select } ) => { - const data = select.persistentData(); - - try { - await apiFetch( { - path: REST_PERSIST_PATH, - method: 'POST', - data, - } ); - } catch ( e ) { - console.error( 'Error saving progress.', e ); - } + await apiFetch( { + path: REST_PERSIST_PATH, + method: 'POST', + data: select.persistentData(), + } ); }; } diff --git a/modules/ppcp-settings/resources/js/data/common/actions-thunk.js b/modules/ppcp-settings/resources/js/data/common/actions-thunk.js index e12537aa8..0de08f245 100644 --- a/modules/ppcp-settings/resources/js/data/common/actions-thunk.js +++ b/modules/ppcp-settings/resources/js/data/common/actions-thunk.js @@ -19,12 +19,10 @@ import { */ export function persist() { return async ( { select } ) => { - const data = select.persistentData(); - await apiFetch( { path: REST_PERSIST_PATH, method: 'POST', - data, + data: select.persistentData(), } ); }; } diff --git a/modules/ppcp-settings/resources/js/data/pay-later-messaging/actions.js b/modules/ppcp-settings/resources/js/data/pay-later-messaging/actions.js index b2e805ae5..f9cd9a556 100644 --- a/modules/ppcp-settings/resources/js/data/pay-later-messaging/actions.js +++ b/modules/ppcp-settings/resources/js/data/pay-later-messaging/actions.js @@ -75,16 +75,10 @@ export const setIsReady = ( isReady ) => setTransient( 'isReady', isReady ); */ export function persist() { return async ( { select } ) => { - const data = select.persistentData(); - - try { - await apiFetch( { - path: REST_PERSIST_PATH, - method: 'POST', - data, - } ); - } catch ( e ) { - console.error( 'Error saving progress.', e ); - } + await apiFetch( { + path: REST_PERSIST_PATH, + method: 'POST', + data: select.persistentData(), + } ); }; } diff --git a/modules/ppcp-settings/resources/js/data/payment/actions.js b/modules/ppcp-settings/resources/js/data/payment/actions.js index c412119d8..1107d5bfb 100644 --- a/modules/ppcp-settings/resources/js/data/payment/actions.js +++ b/modules/ppcp-settings/resources/js/data/payment/actions.js @@ -87,16 +87,10 @@ export const changePaymentSettings = ( id, props ) => ( { */ export function persist() { return async ( { select } ) => { - const data = select.persistentData(); - - try { - await apiFetch( { - path: REST_PERSIST_PATH, - method: 'POST', - data, - } ); - } catch ( e ) { - console.error( 'Error saving progress.', e ); - } + await apiFetch( { + path: REST_PERSIST_PATH, + method: 'POST', + data: select.persistentData(), + } ); }; } diff --git a/modules/ppcp-settings/resources/js/data/settings/actions.js b/modules/ppcp-settings/resources/js/data/settings/actions.js index 9a5ac0a7c..6633516bb 100644 --- a/modules/ppcp-settings/resources/js/data/settings/actions.js +++ b/modules/ppcp-settings/resources/js/data/settings/actions.js @@ -77,16 +77,10 @@ export const setIsReady = ( isReady ) => setTransient( 'isReady', isReady ); */ export function persist() { return async ( { select } ) => { - const data = select.persistentData(); - - try { - await apiFetch( { - path: REST_PERSIST_PATH, - method: 'POST', - data, - } ); - } catch ( e ) { - console.error( 'Error saving progress.', e ); - } + await apiFetch( { + path: REST_PERSIST_PATH, + method: 'POST', + data: select.persistentData(), + } ); }; } diff --git a/modules/ppcp-settings/resources/js/data/styling/actions.js b/modules/ppcp-settings/resources/js/data/styling/actions.js index 48c248c2b..e655e7424 100644 --- a/modules/ppcp-settings/resources/js/data/styling/actions.js +++ b/modules/ppcp-settings/resources/js/data/styling/actions.js @@ -75,16 +75,10 @@ export const setIsReady = ( state ) => setTransient( 'isReady', state ); */ export function persist() { return async ( { select } ) => { - const data = select.persistentData(); - - try { - await apiFetch( { - path: REST_PERSIST_PATH, - method: 'POST', - data, - } ); - } catch ( e ) { - console.error( 'Error saving progress.', e ); - } + await apiFetch( { + path: REST_PERSIST_PATH, + method: 'POST', + data: select.persistentData(), + } ); }; } diff --git a/modules/ppcp-settings/resources/js/data/todos/actions.js b/modules/ppcp-settings/resources/js/data/todos/actions.js index ca14edc89..41ac372cd 100644 --- a/modules/ppcp-settings/resources/js/data/todos/actions.js +++ b/modules/ppcp-settings/resources/js/data/todos/actions.js @@ -48,11 +48,10 @@ export function fetchTodos() { export function persist() { return async ( { select } ) => { - const data = await select.persistentData(); return await apiFetch( { path: REST_PERSIST_PATH, method: 'POST', - data, + data: select.persistentData(), } ); }; }