Skip to content

Commit

Permalink
Skip all authorize errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemd24 committed Aug 13, 2024
1 parent 54c1014 commit 007190f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions js/src/data/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,8 @@ export function* disconnectAllAccounts() {
type: TYPES.DISCONNECT_ACCOUNTS_ALL,
};
} catch ( error ) {
if (
error.errors[
`${ API_NAMESPACE }/rest-api/authorize`
]?.message?.includes(
'No token found associated with the client ID and user'
)
) {
// Skip any error related to revoking WPCOM token.
if ( error.errors[ `${ API_NAMESPACE }/rest-api/authorize` ] ) {
return {
type: TYPES.DISCONNECT_ACCOUNTS_ALL,
};
Expand Down
4 changes: 2 additions & 2 deletions js/src/data/test/disconnectAllAccounts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe( 'Disconnect All Accounts', () => {
} );
} );

it( 'Ignore the error if its because missing WPCOM token', async () => {
it( 'Ignore the error if its thrown from the authorize endpoint', async () => {
mockFetch.mockRejectedValue( {
errors: {
[ `${ API_NAMESPACE }/rest-api/authorize` ]: {
Expand All @@ -57,7 +57,7 @@ describe( 'Disconnect All Accounts', () => {
expect( response ).toEqual( { type: 'DISCONNECT_ACCOUNTS_ALL' } );
} );

it( 'Throw the error unless its related to a missing WPCOM token', async () => {
it( 'Throw the error if it is not related to the authorize endpoint', async () => {
mockFetch.mockRejectedValue( {
errors: {
[ `${ API_NAMESPACE }/ads/connection` ]: {
Expand Down

0 comments on commit 007190f

Please sign in to comment.