Skip to content

Commit

Permalink
update env for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
NwinNwin committed Aug 11, 2023
1 parent 5b50fbd commit b28d156
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ import UpdatePage from "./components/UpdatePage/UpdatePage";
import { ChakraProvider } from "@chakra-ui/react";
import "leaflet/dist/leaflet.css";
import { AuthContextProvider } from "./context/AuthContext";
import { UserAuth } from "./context/AuthContext";
import AboutPage from "./components/AboutPage/AboutPage";

function App() {
const { user } = UserAuth();
console.log(user);
return (
<AuthContextProvider>
<ChakraProvider>
Expand Down
9 changes: 7 additions & 2 deletions src/components/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,13 @@ export default function Home() {
data.sort(compareDates);

//get data
console.log(
`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items/`
);
useEffect(() => {
const getData = async () => {
axios
.get("http://localhost:3001/items")
.get(`http://${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 @@ -154,7 +157,9 @@ export default function Home() {
let userEmail = user.email;
if (user) {
axios
.post("http://localhost:5000/send_email", { userEmail })
.post(`http://${process.env.REACT_APP_AWS_BACKEND_URL}/send_email`, {
userEmail,
})
.then(() => alert("Email Sent Successfully!"))
.catch(() => alert("Email NOT SENT"));
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/InfoModal/InfoModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export default function InfoModal({ setData, isOpen, onClose, props }) {
onClose();
setLoading(false);
axios
.delete(`http://localhost:3001/items/${props.id}`)
.delete(
`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items/${props.id}`
)
.then(() => console.log("Success"))
.catch((err) => console.log(err));
setData((prevItems) => {
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://localhost:3001/items", {
.post(`http://${process.env.REACT_APP_AWS_BACKEND_URL}/items`, {
image: newAddedItem.image,
type: newAddedItem.type,
islost: newAddedItem.islost,
Expand Down

0 comments on commit b28d156

Please sign in to comment.