diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index cd37609..9909655 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -7,3 +7,6 @@ export const markerColorAccessor = 'marker-color'; export const dateOfVisitAccessor = 'date_of_visit'; export const priorityLevelAccessor = 'priority_level'; export const numOfSubmissionsAccessor = 'num_of_submissions'; + +// magic strings +export const AbortErrorName = 'AbortError'; diff --git a/packages/core/src/services/onaApi/services.ts b/packages/core/src/services/onaApi/services.ts index f0fcfc9..ea129e1 100644 --- a/packages/core/src/services/onaApi/services.ts +++ b/packages/core/src/services/onaApi/services.ts @@ -1,5 +1,6 @@ import { flatMap } from 'lodash-es'; import { + AbortErrorName, editSubmissionEndpoint, formEndpoint, markerColorAccessor, @@ -28,7 +29,7 @@ export const customFetch = async (input: RequestInfo, init?: RequestInit, logger retryOn: function (_, error, response) { let retry = false; const method = init?.method ?? 'GET'; - if (error) { + if (error && error.name !== AbortErrorName) { retry = method === 'GET'; } if (response) {