mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
♻️ Remove error handling from persist actions
This commit is contained in:
parent
540be69cc9
commit
9c1e6f3b27
7 changed files with 27 additions and 60 deletions
|
@ -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 );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(),
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(),
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue