Skip to content

Commit

Permalink
Upgrade axios (#2205)
Browse files Browse the repository at this point in the history
* Change so npm i only updates to latest patch and not minor

* Set excact webpack version

* Upgrade axios

* Fix axios import

* Use new get params format
  • Loading branch information
omsaggau authored Nov 9, 2023
1 parent 203408d commit 10b0183
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 100 deletions.
154 changes: 83 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@typescript-eslint/eslint-plugin": "~5.62.0",
"@typescript-eslint/parser": "~5.62.0",
"autoprefixer": "~10.4.16",
"axios": "~0.27.2",
"axios": "~1.6.0",
"babel-loader": "~9.1.3",
"babel-preset-env": "~1.7.0",
"cross-env": "~7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/js/app/map.es6
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Only used in map and menuDropdown parts

import $ from 'jquery'
import * as axios from 'axios'
import axios from 'axios'

import Highcharts from 'highcharts'
import A11y from 'highcharts/modules/accessibility'
Expand Down
20 changes: 11 additions & 9 deletions src/main/resources/react4xp/_entries/ArticleArchive.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Container, Row, Col } from 'react-bootstrap'
import { ChevronDown } from 'react-feather'
import { default as groupBy } from 'ramda/es/groupBy'
import PropTypes from 'prop-types'
import { get } from 'axios'
import axios from 'axios'

function ArticleArchive(props) {
const {
title,
Expand All @@ -28,14 +29,15 @@ function ArticleArchive(props) {

function fetchArticles() {
setLoading(true)
get(articleArchiveService, {
params: {
start: articles.length,
count: 15,
language: language,
pageId: pageId,
},
})
axios
.get(articleArchiveService, {
params: {
start: articles.length,
count: 15,
language: language,
pageId: pageId,
},
})
.then((res) => {
if (res.data.articles.length) {
setArticles((prev) => [...prev, ...res.data.articles])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import {
export const get = (req: XP.Request): XP.Response => {
const start: number = Number(req.params.start) ? Number(req.params.start) : 0
const count: number = Number(req.params.count) ? Number(req.params.count) : 10
const partConfig: RelatedFactPageConfig | undefined = req.params.partConfig
? (JSON.parse(req.params.partConfig) as RelatedFactPageConfig)
: undefined
const partConfig: RelatedFactPageConfig = {
inputType: req.params['partConfig[inputType]'],
contentIdList: req.params['partConfig[contentIdList]'],
}

const result: RelatedFactPages = parseRelatedFactPageData(partConfig, start, count)

Expand Down
Loading

0 comments on commit 10b0183

Please sign in to comment.