Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 617bb03

Browse files
committed
Update nonce outside of json parse
1 parent 452e384 commit 617bb03

File tree

1 file changed

+9
-9
lines changed
  • assets/js/base/context/cart-checkout/checkout/processor

1 file changed

+9
-9
lines changed

assets/js/base/context/cart-checkout/checkout/processor/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,17 @@ const CheckoutProcessor = () => {
222222
} );
223223
} )
224224
.catch( ( errorResponse ) => {
225-
errorResponse.json().then( function ( response ) {
226-
// Update nonce.
227-
triggerFetch.setNonce( errorResponse.headers );
225+
// Update nonce.
226+
triggerFetch.setNonce( errorResponse.headers );
228227

229-
// If new customer ID returned, update the store.
230-
if ( errorResponse.headers?.get( 'X-WC-Store-API-User' ) ) {
231-
dispatchActions.setCustomerId(
232-
errorResponse.headers.get( 'X-WC-Store-API-User' )
233-
);
234-
}
228+
// If new customer ID returned, update the store.
229+
if ( errorResponse.headers?.get( 'X-WC-Store-API-User' ) ) {
230+
dispatchActions.setCustomerId(
231+
errorResponse.headers.get( 'X-WC-Store-API-User' )
232+
);
233+
}
235234

235+
errorResponse.json().then( function ( response ) {
236236
// If updated cart state was returned, update the store.
237237
if ( response.data?.cart ) {
238238
receiveCart( response.data.cart );

0 commit comments

Comments
 (0)