|
|
|
@ -2,6 +2,7 @@ import type { CallApiArgs } from './types' |
|
|
|
import { parseJSON } from './parseJSON' |
|
|
|
import { parseJSON } from './parseJSON' |
|
|
|
import { checkStatus } from './checkStatus' |
|
|
|
import { checkStatus } from './checkStatus' |
|
|
|
import { getRequestConfig } from './getRequestConfig' |
|
|
|
import { getRequestConfig } from './getRequestConfig' |
|
|
|
|
|
|
|
import { logoutIfUnauthorized } from './logoutIfUnauthorized' |
|
|
|
|
|
|
|
|
|
|
|
export const callApiBase = ({ |
|
|
|
export const callApiBase = ({ |
|
|
|
abortSignal, |
|
|
|
abortSignal, |
|
|
|
@ -38,7 +39,7 @@ const callApiWithTimeout = (args: CallApiArgs) => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(checkStatus) |
|
|
|
.then(checkStatus) |
|
|
|
.then(parseJSON) |
|
|
|
.then(parseJSON) |
|
|
|
// .catch(logoutIfUnauthorized)
|
|
|
|
.catch(logoutIfUnauthorized) |
|
|
|
.finally(() => clearTimeout(timeoutId)) |
|
|
|
.finally(() => clearTimeout(timeoutId)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -48,5 +49,5 @@ export const callApi = (args: CallApiArgs) => { |
|
|
|
return callApiBase(args) |
|
|
|
return callApiBase(args) |
|
|
|
.then(checkStatus) |
|
|
|
.then(checkStatus) |
|
|
|
.then(parseJSON) |
|
|
|
.then(parseJSON) |
|
|
|
// .catch(logoutIfUnauthorized)
|
|
|
|
.catch(logoutIfUnauthorized) |
|
|
|
} |
|
|
|
} |
|
|
|
|