Skip to content

Commit

Permalink
fix api in axios calls
Browse files Browse the repository at this point in the history
  • Loading branch information
NwinNwin committed Aug 13, 2023
1 parent 7434e04 commit 771280f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/components/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,11 @@ export default function Home() {
data.sort(compareDates);

//get data
console.log(
`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items/`
);
console.log(`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items/`);
useEffect(() => {
const getData = async () => {
axios
.get(`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items/`)
.get(`${process.env.REACT_APP_AWS_BACKEND_URL}/items/`)
.then((obj) => {
console.log("s", obj.data);
setData(obj.data.map((item) => ({ ...item, id: item.id })));
Expand All @@ -157,7 +155,7 @@ export default function Home() {
let userEmail = user.email;
if (user) {
axios
.post(`http://${process.env.REACT_APP_AWS_BACKEND_URL}/send_email`, {
.post(`${process.env.REACT_APP_AWS_BACKEND_URL}/send_email`, {
userEmail,
})
.then(() => alert("Email Sent Successfully!"))
Expand Down
2 changes: 1 addition & 1 deletion src/components/InfoModal/InfoModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function InfoModal({ setData, isOpen, onClose, props }) {
setLoading(false);
axios
.delete(
`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items/${props.id}`
`${process.env.REACT_APP_AWS_BACKEND_URL}/items/${props.id}`
)
.then(() => console.log("Success"))
.catch((err) => console.log(err));
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default function Map({
const date = new Date();

axios
.post(`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items`, {
.post(`${process.env.REACT_APP_AWS_BACKEND_URL}/items`, {
image: newAddedItem.image,
type: newAddedItem.type,
islost: newAddedItem.islost,
Expand Down

0 comments on commit 771280f

Please sign in to comment.