diff --git a/ui-pf4/src/main/webapp/package.json b/ui-pf4/src/main/webapp/package.json index 4e003de5c..d28f7c435 100644 --- a/ui-pf4/src/main/webapp/package.json +++ b/ui-pf4/src/main/webapp/package.json @@ -29,7 +29,7 @@ "@types/websocket": "^1.0.5", "@types/yup": "0.29.6", "antd": "4.7.0", - "axios": "1.6.0", + "axios": "^0.28.0", "axios-mock-adapter": "^1.21.2", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.7", @@ -66,7 +66,8 @@ "@types/react": "^16.9.49", "follow-redirects": "^1.15.6", "semver": "^7.5.4", - "tough-cookie": "^4.1.3" + "tough-cookie": "^4.1.3", + "axios": "^0.28.0" }, "scripts": { "start": "react-scripts start", diff --git a/ui-pf4/src/main/webapp/src/api/apiInit.ts b/ui-pf4/src/main/webapp/src/api/apiInit.ts index a3ee4b600..82be58da7 100644 --- a/ui-pf4/src/main/webapp/src/api/apiInit.ts +++ b/ui-pf4/src/main/webapp/src/api/apiInit.ts @@ -10,6 +10,7 @@ export const initInterceptors = (getToken: () => Promise) => { axios.interceptors.request.use( async (config) => { const token = await getToken(); + if (!config.headers) config.headers = {}; if (token) config.headers["Authorization"] = "Bearer " + token; return config; }, diff --git a/ui-pf4/src/main/webapp/yarn.lock b/ui-pf4/src/main/webapp/yarn.lock index 6a4f117fe..4a75c2e75 100644 --- a/ui-pf4/src/main/webapp/yarn.lock +++ b/ui-pf4/src/main/webapp/yarn.lock @@ -3503,22 +3503,15 @@ axios-mock-adapter@^1.21.2: fast-deep-equal "^3.1.3" is-buffer "^2.0.5" -axios@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.0.tgz#f1e5292f26b2fd5c2e66876adc5b06cdbd7d2102" - integrity sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg== +axios@^0.19.0, axios@^0.28.0: + version "0.28.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.28.1.tgz#2a7bcd34a3837b71ee1a5ca3762214b86b703e70" + integrity sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ== dependencies: follow-redirects "^1.15.0" form-data "^4.0.0" proxy-from-env "^1.1.0" -axios@^0.19.0: - version "0.19.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" - integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== - dependencies: - follow-redirects "1.5.10" - axobject-query@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be" @@ -6044,7 +6037,7 @@ focus-trap@6.9.2: dependencies: tabbable "^5.3.2" -follow-redirects@1.5.10, follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.15.6: +follow-redirects@^1.0.0, follow-redirects@^1.15.0, follow-redirects@^1.15.6: version "1.15.6" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==