Skip to content

Commit

Permalink
Merge: merge feature/107 to main
Browse files Browse the repository at this point in the history
Refactor: localhost to env.URL #107
  • Loading branch information
mjk25 authored May 28, 2024
2 parents c49d3b2 + 5af3bf3 commit b08ed6c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/pages/DiaryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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);
})
Expand Down
2 changes: 1 addition & 1 deletion src/pages/DiaryWritePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditDiaryWritePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
})
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditProfilPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/MainPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/pages/MypagePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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) {
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TagPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b08ed6c

Please sign in to comment.