Skip to content

Commit

Permalink
Fix address search method due to axios issue (#4129)
Browse files Browse the repository at this point in the history
- Upgrade axios version to latest version
  • Loading branch information
Jaewoook committed Oct 11, 2021
1 parent 0597e5f commit 82b21ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@ant-design/icons": "^4.1.0",
"@sentry/react": "^6.13.3",
"antd": "^4.4.1",
"axios": "^0.21.2",
"axios": "^0.22.0",
"copy-to-clipboard": "^3.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
13 changes: 6 additions & 7 deletions src/AddressManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios";
import axios, { AxiosResponse } from "axios";
import { getRuntime } from "./utils";
import { SettingsManager, Settings, DEFAULT_SETTINGS } from "./SettingsManager";

Expand Down Expand Up @@ -73,23 +73,22 @@ export class AddressManager {
form.append("countPerPage", searchKey.countPerPage);
form.append("keyword", searchKey.keyword);

axios.request<AddressResponse>({
axios.request<FormData, AxiosResponse<APIResponse>>({
method: "POST",
url: JUSO_API,
data: form,
responseType: "json",
transformResponse: (r: APIResponse) => r.results,
}).then(async (res) => {
console.log(res.data.juso);
console.log(res.data);
if (append) {
// prevent search next page
if (!res.data.juso.length) {
if (!res.data.results.juso.length) {
searchKey.end = true;
} else {
this.addressData = [...this.addressData, ...res.data.juso];
this.addressData = [...this.addressData, ...res.data.results.juso];
}
} else {
this.addressData = res.data.juso || [];
this.addressData = res.data.results.juso || [];
}
try {
await this.settingsManager?.updateSettings({
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3106,12 +3106,12 @@ axe-core@^4.0.2:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.3.3.tgz#b55cd8e8ddf659fe89b064680e1c6a4dceab0325"
integrity sha512-/lqqLAmuIPi79WYfRpy2i8z+x+vxU3zX2uAm0gs1q52qTuKwolOj1P8XbufpXcsydrpKx2yGn2wzAnxCMV86QA==

axios@^0.21.2:
version "0.21.4"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575"
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==
axios@^0.22.0:
version "0.22.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.22.0.tgz#bf702c41fb50fbca4539589d839a077117b79b25"
integrity sha512-Z0U3uhqQeg1oNcihswf4ZD57O3NrR1+ZXhxaROaWpDmsDTx7T2HNBV2ulBtie2hwJptu8UvgnJoK+BIqdzh/1w==
dependencies:
follow-redirects "^1.14.0"
follow-redirects "^1.14.4"

axobject-query@^2.2.0:
version "2.2.0"
Expand Down Expand Up @@ -5791,7 +5791,7 @@ follow-redirects@^1.0.0:
dependencies:
debug "^3.0.0"

follow-redirects@^1.14.0:
follow-redirects@^1.14.4:
version "1.14.4"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379"
integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==
Expand Down

0 comments on commit 82b21ad

Please sign in to comment.