Skip to content

Commit

Permalink
chore: change to axios from fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
EXPITC committed May 28, 2023
1 parent db1b132 commit 32285e9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/components/CartPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import trash from "../../img/Trash.svg";
import Header from "../Header";
import Map from "../Map";
import { useNavigate } from "react-router";
import axios from "axios";

const CartPage = () => {
const [open, setOpen] = useState(false);
Expand Down Expand Up @@ -188,12 +189,14 @@ const CartPage = () => {
const signal = controller.signal;
(async () => {
try {
await fetch(
`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${loc[0]}&lon=${loc[1]}`,
{ signal }
).then((res) => {
setAddress(res.data);
});
await axios
.get(
`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${loc[0]}&lon=${loc[1]}`,
{ signal }
)
.then((res) => {
setAddress(res.data);
});
setForm((prev) => ({
...prev,
location: loc[0] + " " + loc[1],
Expand Down

0 comments on commit 32285e9

Please sign in to comment.