♻️ Remove error handling from persist actions

This commit is contained in:
Philipp Stracker 2025-02-07 12:07:12 +01:00
parent 540be69cc9
commit 9c1e6f3b27
No known key found for this signature in database
7 changed files with 27 additions and 60 deletions

View file

@ -75,16 +75,10 @@ export const setIsReady = ( isReady ) => setTransient( 'isReady', isReady );
*/ */
export function persist() { export function persist() {
return async ( { select } ) => { return async ( { select } ) => {
const data = select.persistentData(); await apiFetch( {
path: REST_PERSIST_PATH,
try { method: 'POST',
await apiFetch( { data: select.persistentData(),
path: REST_PERSIST_PATH, } );
method: 'POST',
data,
} );
} catch ( e ) {
console.error( 'Error saving progress.', e );
}
}; };
} }

View file

@ -19,12 +19,10 @@ import {
*/ */
export function persist() { export function persist() {
return async ( { select } ) => { return async ( { select } ) => {
const data = select.persistentData();
await apiFetch( { await apiFetch( {
path: REST_PERSIST_PATH, path: REST_PERSIST_PATH,
method: 'POST', method: 'POST',
data, data: select.persistentData(),
} ); } );
}; };
} }

View file

@ -75,16 +75,10 @@ export const setIsReady = ( isReady ) => setTransient( 'isReady', isReady );
*/ */
export function persist() { export function persist() {
return async ( { select } ) => { return async ( { select } ) => {
const data = select.persistentData(); await apiFetch( {
path: REST_PERSIST_PATH,
try { method: 'POST',
await apiFetch( { data: select.persistentData(),
path: REST_PERSIST_PATH, } );
method: 'POST',
data,
} );
} catch ( e ) {
console.error( 'Error saving progress.', e );
}
}; };
} }

View file

@ -87,16 +87,10 @@ export const changePaymentSettings = ( id, props ) => ( {
*/ */
export function persist() { export function persist() {
return async ( { select } ) => { return async ( { select } ) => {
const data = select.persistentData(); await apiFetch( {
path: REST_PERSIST_PATH,
try { method: 'POST',
await apiFetch( { data: select.persistentData(),
path: REST_PERSIST_PATH, } );
method: 'POST',
data,
} );
} catch ( e ) {
console.error( 'Error saving progress.', e );
}
}; };
} }

View file

@ -77,16 +77,10 @@ export const setIsReady = ( isReady ) => setTransient( 'isReady', isReady );
*/ */
export function persist() { export function persist() {
return async ( { select } ) => { return async ( { select } ) => {
const data = select.persistentData(); await apiFetch( {
path: REST_PERSIST_PATH,
try { method: 'POST',
await apiFetch( { data: select.persistentData(),
path: REST_PERSIST_PATH, } );
method: 'POST',
data,
} );
} catch ( e ) {
console.error( 'Error saving progress.', e );
}
}; };
} }

View file

@ -75,16 +75,10 @@ export const setIsReady = ( state ) => setTransient( 'isReady', state );
*/ */
export function persist() { export function persist() {
return async ( { select } ) => { return async ( { select } ) => {
const data = select.persistentData(); await apiFetch( {
path: REST_PERSIST_PATH,
try { method: 'POST',
await apiFetch( { data: select.persistentData(),
path: REST_PERSIST_PATH, } );
method: 'POST',
data,
} );
} catch ( e ) {
console.error( 'Error saving progress.', e );
}
}; };
} }

View file

@ -48,11 +48,10 @@ export function fetchTodos() {
export function persist() { export function persist() {
return async ( { select } ) => { return async ( { select } ) => {
const data = await select.persistentData();
return await apiFetch( { return await apiFetch( {
path: REST_PERSIST_PATH, path: REST_PERSIST_PATH,
method: 'POST', method: 'POST',
data, data: select.persistentData(),
} ); } );
}; };
} }