Skip to content

Commit

Permalink
fix: 배포 > 로컬 설정 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
leehyelim0691 committed Sep 2, 2022
1 parent f0ca115 commit 22081e8
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 103 deletions.
7 changes: 7 additions & 0 deletions FrontEnd/rebon-frontend/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
REACT_APP_GOOGLE_LOGIN=66233621795-q2t3h8jvd5qc36n4j6j96ejrclnhu4eq.apps.googleusercontent.com
REACT_APP_NAVER_LOGIN=LMoG83yi5hLpLfCCg1fa
REACT_APP_KAKAO_LOGIN=1c4b166500016e67df420423d02e187b

REACT_APP_AWS_ACCESS_KEY_ID = AKIAWHWKYOWONYWK7TQK
process.env.REACT_APP_AWS_SECRET_ACCESS_KEY = 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

38 changes: 20 additions & 18 deletions FrontEnd/rebon-frontend/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions FrontEnd/rebon-frontend/src/pages/Login/LoginButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ export default function SNSButtons() {
}, []);

const googleLoginHandler = () => {
const GOOGLE_LOGIN_URL = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${googleClientId}&redirect_uri=http://localhost:3000/loading&response_type=code&scope=https://www.googleapis.com/auth/userinfo.email`;
const GOOGLE_LOGIN_URL = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${googleClientId}&redirect_uri=http://rebon.s3-website.ap-northeast-2.amazonaws.com/loading&response_type=code&scope=https://www.googleapis.com/auth/userinfo.email`;
window.location.href = GOOGLE_LOGIN_URL;
};

const naverLoginHandler = () => {
// const NAVER_LOGIN_URL = `https://nid.naver.com/oauth2.0/authorize?response_type=code&client_id=${naverClientId}&redirect_uri=http://rebon.s3-website.ap-northeast-2.amazonaws.com/loading`;
const NAVER_LOGIN_URL = `https://nid.naver.com/oauth2.0/authorize?response_type=code&client_id=${naverClientId}&redirect_uri=http://localhost:3000/loading`;
window.location.href = NAVER_LOGIN_URL;
};

const kakaoLoginHandler = () => {
const KAKAO_LOGIN_URL = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${kakaoClientId}&redirect_uri=http://localhost:3000/loading`;
const KAKAO_LOGIN_URL = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${kakaoClientId}&redirect_uri=http://rebon.s3-website.ap-northeast-2.amazonaws.com/loading`;
window.location.href = KAKAO_LOGIN_URL;
};

Expand Down
106 changes: 23 additions & 83 deletions FrontEnd/rebon-frontend/src/pages/Main/MainShopData/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { useLocation } from 'react-router';
import Main from '../../Main';
import Loading from '../../Login/Loading';
import Loading from "../../Login/Loading";

export default function MainShopData({ restCategory, accoCategory, cafeCategory }) {
const location = useLocation();
const [ready, setReady] = useState(false);
const [restData, setRestData] = useState(null);
const [accoData, setAccoData] = useState(null);
const [cafeData, setCafeData] = useState(null);
const [token, setToken] = useState(window.sessionStorage.getItem('token'));

useEffect(() => {
setReady(false);
Expand All @@ -20,82 +19,24 @@ export default function MainShopData({ restCategory, accoCategory, cafeCategory
var cafeArr = [];

restCategory.map((data, index) => {
var url = 'http://3.34.139.61:8080/api/shops?tag=' + location.state.item.id + '&category=1&subCategories=' + data.id + '&open=false&sort=shopScore.star%2Cdesc';
var shopId;
axios.get(url).then((response) => {
const restState = { id: data.id, shop: response.data };
response.data.map((shopData, idx) => {
shopId = shopData.id;

const config = {
headers: { Authorization: `Bearer ${token}` },
};
if (token) {
axios
.get('http://3.34.139.61:8080/api/shops/' + shopData.id + '/isLike', config)
.then((response) => {
if (response.data) {
restState.shop[idx].like = true;
}
})
.catch((error) => {
console.log(error);
});
}
});

restArr.push(restState);
});
const noRest = [74, 91,29];
if(!(noRest.includes(data.id))) {
var url = 'http://3.34.139.61:8080/api/shops?tag=' + location.state.item.id + '&category=1&subCategories=' + data.id + '&open=false&sort=shopScore.star%2Cdesc';
axios
.get(url)
.then((response) => {
const restState = { id: data.id, shop: response.data };
restArr.push(restState);
})
.catch((error) => {
if (error.response.status === 500) {
restArr.push([]);
} else console.log('restShop error');
});
}
});
setRestData(restArr);

accoCategory.map((data, index) => {
var url = 'http://3.34.139.61:8080/api/shops?tag=' + location.state.item.id + '&category=1&subCategories=' + data.id + '&open=false&sort=shopScore.star%2Cdesc';
var shopId;
axios.get(url).then((response) => {
const accoState = { id: data.id, shop: response.data };
response.data.map((shopData, idx) => {
shopId = shopData.id;

const config = {
headers: { Authorization: `Bearer ${token}` },
};
if (token) {
axios
.get('http://3.34.139.61:8080/api/shops/' + shopData.id + '/isLike', config)
.then((response) => {
if (response.data) {
accoState.shop[idx].like = true;
}
})
.catch((error) => {
console.log(error);
});
}
});
accoArr.push(accoState);
});
});
setAccoData(accoArr);

// const noRest = [74, 91,29];
// if(!(noRest.includes(data.id))) {
// var url = 'http://3.34.139.61:8080/api/shops?tag=' + location.state.item.id + '&category=1&subCategories=' + data.id + '&open=false&sort=shopScore.star%2Cdesc';
// axios
// .get(url)
// .then((response) => {
// const restState = { id: data.id, shop: response.data };
// restArr.push(restState);
// })
// .catch((error) => {
// if (error.response.status === 500) {
// restArr.push([]);
// } else console.log('restShop error');
// });
// }
// });
// setRestData(restArr);

cafeCategory.map((data, index) => {
const noCafe = [96];
// if(!(noCafe.includes(data.id))){
Expand All @@ -115,6 +56,7 @@ export default function MainShopData({ restCategory, accoCategory, cafeCategory
});
setCafeData(cafeArr);


accoCategory.map((data, index) => {
const noAcco = [100, 102, 99, 101, 18, 98, 17, 16];
// if(!(noAcco.includes(data.id))) {
Expand All @@ -136,13 +78,11 @@ export default function MainShopData({ restCategory, accoCategory, cafeCategory
setReady(true);
}, []);


return (
<>
{ready ? (
<Main restCategory={restCategory} accoCategory={accoCategory} cafeCategory={cafeCategory} restData={restData} accoData={accoData} cafeData={cafeData} />
) : (
<Loading />
)}
</>
<>{ready ?
<Main restCategory={restCategory} accoCategory={accoCategory} cafeCategory={cafeCategory} restData={restData} accoData={accoData} cafeData={cafeData} />
: <Loading/>
}</>
);
}
}

0 comments on commit 22081e8

Please sign in to comment.