diff --git a/src/pages/DiaryPage.js b/src/pages/DiaryPage.js index 147dd54..a1eb949 100644 --- a/src/pages/DiaryPage.js +++ b/src/pages/DiaryPage.js @@ -21,7 +21,7 @@ const DiaryPage = () => { const [isModalOpen, setIsModalOpen] = useState(false); useEffect(() => { - axios.get(`http://localhost:5000/diary/${diaryId}`, { withCredentials: true}) + axios.get(`${process.env.REACT_APP_SERVER_URL}/diary/${diaryId}`, { withCredentials: true}) .then((res) => { const data = res.data.diaryinfo; setDiaryInfo({ @@ -67,7 +67,7 @@ const DiaryPage = () => { }; const closeModal = () => { - axios.delete(`http://localhost:5000/diary/${diaryId}`, { withCredentials: true}) + axios.delete(`${process.env.REACT_APP_SERVER_URL}/diary/${diaryId}`, { withCredentials: true}) .then((res) => { // console.log(res); }) diff --git a/src/pages/DiaryWritePage.js b/src/pages/DiaryWritePage.js index 03cb11c..151d7e7 100644 --- a/src/pages/DiaryWritePage.js +++ b/src/pages/DiaryWritePage.js @@ -66,7 +66,7 @@ const DiaryWritePage = () => { console.log(`${key}: ${value}`); } - axios.post("http://localhost:5000/diary", formData, { withCredentials: true, headers: {"Content-Type": "multipart/form-data"} }) + axios.post(`${process.env.REACT_APP_SERVER_URL}/diary`, formData, { withCredentials: true, headers: {"Content-Type": "multipart/form-data"} }) .then((res) => { console.log("res.data:", res.data); setDiaryId(res.data.diaryid); diff --git a/src/pages/EditDiaryWritePage.js b/src/pages/EditDiaryWritePage.js index 963050e..2ae72ac 100644 --- a/src/pages/EditDiaryWritePage.js +++ b/src/pages/EditDiaryWritePage.js @@ -76,7 +76,7 @@ const EditDiaryWritePage = () => { console.log(`${key}: ${value}`); } - axios.put(`http://localhost:5000/diary/${diaryId}`, formData, { withCredentials: true, headers: {"Content-Type": "multipart/form-data"} }) + axios.put(`${process.env.REACT_APP_SERVER_URL}/diary/${diaryId}`, formData, { withCredentials: true, headers: {"Content-Type": "multipart/form-data"} }) .then((res) => { navigate("/showdiary"); }) diff --git a/src/pages/EditProfilPage.js b/src/pages/EditProfilPage.js index b5ed175..301782b 100644 --- a/src/pages/EditProfilPage.js +++ b/src/pages/EditProfilPage.js @@ -41,7 +41,7 @@ const EditProfilPage = () => { } - axios.put("http://localhost:5000/user", formData, + axios.put(`${process.env.REACT_APP_SERVER_URL}/user`, formData, { withCredentials: true }) .then((res) => { if (res === 404) { diff --git a/src/pages/MainPage.js b/src/pages/MainPage.js index 8581fdd..9fc7952 100644 --- a/src/pages/MainPage.js +++ b/src/pages/MainPage.js @@ -25,7 +25,7 @@ const MainPage = () => { const [tagImages, setTagImages] = useState([]); useEffect(() => { - axios.get("http://localhost:5000/user", { withCredentials: true}) + axios.get(`${process.env.REACT_APP_SERVER_URL}/user`, { withCredentials: true}) .then((res) => { setUserName(res.data.userinfo.name); }) @@ -35,7 +35,7 @@ const MainPage = () => { }, []); useEffect(() => { - axios.get("http://localhost:5000/tag", { withCredentials: true}) + axios.get(`${process.env.REACT_APP_SERVER_URL}/tag`, { withCredentials: true}) .then((res) => { const data = res.data.imageTags; diff --git a/src/pages/MypagePage.js b/src/pages/MypagePage.js index ef9d041..57a005f 100644 --- a/src/pages/MypagePage.js +++ b/src/pages/MypagePage.js @@ -45,7 +45,7 @@ const MypagePage = () => { }, []); const handleUserInfo = () => { - axios.get("http://localhost:5000/user", { withCredentials: true}) + axios.get(`${process.env.REACT_APP_SERVER_URL}/user`, { withCredentials: true}) .then((res) => { const data = res.data.userinfo; setUserInfo( @@ -71,7 +71,7 @@ const MypagePage = () => { }; const handleLogout = () => { - axios.delete("http://localhost:5000/user/logout", { withCredentials: true}) + axios.delete(`${process.env.REACT_APP_SERVER_URL}/user/logout`, { withCredentials: true}) .then((response) => { const status = response.status; if (status === 200) { @@ -90,7 +90,7 @@ const MypagePage = () => { const DelAccount = () =>{ - axios.delete("http://localhost:5000/user", { withCredentials: true}) + axios.delete(`${process.env.REACT_APP_SERVER_URL}/user`, { withCredentials: true}) .then((response) => { const status = response.status; console.log("res",status); diff --git a/src/pages/TagPage.js b/src/pages/TagPage.js index baffa96..15a248a 100644 --- a/src/pages/TagPage.js +++ b/src/pages/TagPage.js @@ -33,7 +33,7 @@ export default function TagPage() { const [tagImages, setTagImages] = useState([]); useEffect(() => { - axios.get(`http://localhost:5000/tag/${tagName}`, { withCredentials: true }) + axios.get(`${process.env.REACT_APP_SERVER_URL}/tag/${tagName}`, { withCredentials: true }) .then((res) => { const data = res.data.images; setTagImages(data);