Skip to content

Commit

Permalink
Oppgraderer axios til v1
Browse files Browse the repository at this point in the history
  • Loading branch information
hallvardastark committed Nov 10, 2023
1 parent 9a45d0e commit 3bff41b
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@popperjs/core": "2.11.8",
"@sentry/browser": "7.77.0",
"@storybook/testing-react": "2.0.1",
"axios": "0.27.2",
"axios": "1.6.1",
"core-js": "3.33.2",
"date-fns": "2.30.0",
"date-fns-tz": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-opplaeringspenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@navikt/ft-fakta-beregning-redesign": "1.0.12",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.3.13",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.15",
"axios": "0.27.2",
"axios": "1.6.1",
"nav-frontend-alertstriper": "4.0.2",
"react": "18.2.0",
"react-intl": "6.5.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-pleiepenger-sluttfase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@navikt/ft-fakta-beregning-redesign": "1.0.12",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.3.13",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.15",
"axios": "0.27.2",
"axios": "1.6.1",
"nav-frontend-alertstriper": "4.0.2",
"react": "18.2.0",
"react-intl": "6.5.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/behandling-pleiepenger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@navikt/ft-fakta-beregning-redesign": "1.0.12",
"@navikt/ft-fakta-fordel-beregningsgrunnlag": "7.3.13",
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.15",
"axios": "0.27.2",
"axios": "1.6.1",
"nav-frontend-alertstriper": "4.0.2",
"react": "18.2.0",
"react-intl": "6.5.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"private": true,
"dependencies": {
"@sentry/browser": "7.77.0",
"axios": "0.27.2",
"axios": "1.6.1",
"node-cache": "5.1.2"
}
}
6 changes: 3 additions & 3 deletions packages/rest-api/src/axios/axiosEtag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SOFTWARE.
*/

import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
import axios, { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';

import NodeCache from 'node-cache';

Expand Down Expand Up @@ -80,13 +80,13 @@ function getCacheByAxiosConfig(config: AxiosRequestConfig) {
return EtagCache.get(getUUIDByAxiosConfig(config));
}

function requestInterceptor(config: AxiosRequestConfig) {
function requestInterceptor(config: InternalAxiosRequestConfig) {
if (isCacheableMethod(config)) {
const uuid = getUUIDByAxiosConfig(config);
const lastCachedResult = EtagCache.get(uuid);
if (lastCachedResult) {
// eslint-disable-next-line no-param-reassign
config.headers = { ...config.headers, 'If-None-Match': lastCachedResult.etag };
config.headers = new AxiosHeaders({ ...config.headers, 'If-None-Match': lastCachedResult.etag });
}
}
return config;
Expand Down
1 change: 1 addition & 0 deletions packages/rest-api/src/axios/axiosHttpClientApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('axiosHttpClientApi', () => {
let mockAxios;

beforeAll(() => {
// @ts-ignore
mockAxios = new MockAdapter(httpClientApi.axiosInstance);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/sak-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@navikt/ft-prosess-beregningsgrunnlag": "6.3.15",
"@navikt/ft-ui-komponenter": "2.1.13",
"@sentry/browser": "7.77.0",
"axios": "0.27.2",
"axios": "1.6.1",
"classnames": "2.3.2",
"history": "5.3.0",
"moment": "2.29.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@navikt/ds-react": "5.10.0",
"@navikt/fnrvalidator": "1.3.3",
"@navikt/ft-plattform-komponenter": "2.3.9",
"axios": "0.27.2",
"axios": "1.6.1",
"classnames": "2.3.2",
"date-fns": "2.30.0",
"date-fns-tz": "2.0.0",
Expand Down
27 changes: 14 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4030,7 +4030,7 @@ __metadata:
"@navikt/ds-react": 5.10.0
"@navikt/fnrvalidator": 1.3.3
"@navikt/ft-plattform-komponenter": 2.3.9
axios: 0.27.2
axios: 1.6.1
classnames: 2.3.2
date-fns: 2.30.0
date-fns-tz: 2.0.0
Expand Down Expand Up @@ -4769,7 +4769,7 @@ __metadata:
"@navikt/ft-fakta-beregning-redesign": 1.0.12
"@navikt/ft-fakta-fordel-beregningsgrunnlag": 7.3.13
"@navikt/ft-prosess-beregningsgrunnlag": 6.3.15
axios: 0.27.2
axios: 1.6.1
axios-mock-adapter: 1.22.0
enzyme: 3.11.0
nav-frontend-alertstriper: 4.0.2
Expand Down Expand Up @@ -4819,7 +4819,7 @@ __metadata:
"@navikt/ft-fakta-beregning-redesign": 1.0.12
"@navikt/ft-fakta-fordel-beregningsgrunnlag": 7.3.13
"@navikt/ft-prosess-beregningsgrunnlag": 6.3.15
axios: 0.27.2
axios: 1.6.1
axios-mock-adapter: 1.22.0
enzyme: 3.11.0
nav-frontend-alertstriper: 4.0.2
Expand Down Expand Up @@ -4871,7 +4871,7 @@ __metadata:
"@navikt/ft-fakta-beregning-redesign": 1.0.12
"@navikt/ft-fakta-fordel-beregningsgrunnlag": 7.3.13
"@navikt/ft-prosess-beregningsgrunnlag": 6.3.15
axios: 0.27.2
axios: 1.6.1
axios-mock-adapter: 1.22.0
enzyme: 3.11.0
nav-frontend-alertstriper: 4.0.2
Expand Down Expand Up @@ -5424,7 +5424,7 @@ __metadata:
resolution: "@k9-sak-web/rest-api@workspace:packages/rest-api"
dependencies:
"@sentry/browser": 7.77.0
axios: 0.27.2
axios: 1.6.1
node-cache: 5.1.2
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -5504,7 +5504,7 @@ __metadata:
"@navikt/ft-prosess-beregningsgrunnlag": 6.3.15
"@navikt/ft-ui-komponenter": 2.1.13
"@sentry/browser": 7.77.0
axios: 0.27.2
axios: 1.6.1
classnames: 2.3.2
history: 5.3.0
moment: 2.29.4
Expand Down Expand Up @@ -11121,13 +11121,14 @@ __metadata:
languageName: node
linkType: hard

"axios@npm:0.27.2":
version: 0.27.2
resolution: "axios@npm:0.27.2"
"axios@npm:1.6.1":
version: 1.6.1
resolution: "axios@npm:1.6.1"
dependencies:
follow-redirects: ^1.14.9
follow-redirects: ^1.15.0
form-data: ^4.0.0
checksum: 38cb7540465fe8c4102850c4368053c21683af85c5fdf0ea619f9628abbcb59415d1e22ebc8a6390d2bbc9b58a9806c874f139767389c862ec9b772235f06854
proxy-from-env: ^1.1.0
checksum: 573f03f59b7487d54551b16f5e155d1d130ad4864ed32d1da93d522b78a57123b34e3bde37f822a65ee297e79f1db840f9ad6514addff50d3cbf5caeed39e8dc
languageName: node
linkType: hard

Expand Down Expand Up @@ -15186,7 +15187,7 @@ __metadata:
languageName: node
linkType: hard

"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.14.9, follow-redirects@npm:^1.15.0":
"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.15.0":
version: 1.15.2
resolution: "follow-redirects@npm:1.15.2"
peerDependenciesMeta:
Expand Down Expand Up @@ -18212,7 +18213,7 @@ __metadata:
"@typescript-eslint/parser": 6.9.1
"@wojtekmaj/enzyme-adapter-react-17": 0.8.0
autoprefixer: ^10.4.16
axios: 0.27.2
axios: 1.6.1
axios-mock-adapter: 1.22.0
babel-jest: 29.7.0
babel-loader: 9.1.3
Expand Down

0 comments on commit 3bff41b

Please sign in to comment.