mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
AAE-30358 Update Retry connection logic to allow retry when the graphql return unauthorized error
This commit is contained in:
parent
76999ee830
commit
10346dbf1f
@ -141,9 +141,25 @@ export class WebSocketService {
|
|||||||
max: Number.POSITIVE_INFINITY,
|
max: Number.POSITIVE_INFINITY,
|
||||||
jitter: true
|
jitter: true
|
||||||
},
|
},
|
||||||
attempts: {
|
attempts: (count: number, _operation: Operation, error: any) => {
|
||||||
max: 5,
|
if (!error) {
|
||||||
retryIf: (error) => !!error
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isUnauthorizedError =
|
||||||
|
(Array.isArray(error) &&
|
||||||
|
error.some(
|
||||||
|
(err: any) =>
|
||||||
|
err?.extensions?.code === 'UNAUTHORIZED' ||
|
||||||
|
err?.message?.includes('4401') ||
|
||||||
|
err?.message?.toLowerCase().includes('unauthorized')
|
||||||
|
)) ||
|
||||||
|
(typeof error === 'string' && (error.includes('4401') || error.toLowerCase().includes('unauthorized'))) ||
|
||||||
|
(error?.message && (error.message.includes('4401') || error.message.toLowerCase().includes('unauthorized')));
|
||||||
|
|
||||||
|
const shouldRetry = isUnauthorizedError ? this.authService.isLoggedIn() : count < 5;
|
||||||
|
|
||||||
|
return shouldRetry;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user