Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
[Feat]::Kakao msg 구현중 #65
Browse files Browse the repository at this point in the history
  • Loading branch information
qhahd78 committed Jan 3, 2022
1 parent 149f998 commit 102248b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- 카카오 메세지 -->
<script src="https://developers.kakao.com/sdk/js/kakao.js"></script>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
14 changes: 14 additions & 0 deletions src/Components/Detail/Reservation/Step2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ const Person = styled.span`
padding-bottom: 15px;
`;

const { Kakao } = window;

const Step2 = ({ restaurantName, increasePageFunc, decreasePageFunc }) => {
const navigate = useNavigate();
const [Today, setToday] = useState('');
Expand All @@ -103,6 +105,17 @@ const Step2 = ({ restaurantName, increasePageFunc, decreasePageFunc }) => {
const [MyWaiting, setMyWaiting] = useRecoilState(waitingState);
const [MyResName, setMyResName] = useRecoilState(myRestaurantName);

const sendMsg = () => {
console.log(Kakao);
Kakao.Link.sendDefault({
objectType: 'text',
text: '테스트입니다',
link: {
webUrl: 'https://naver.com',
},
});
};

// waiting 제출 및 다음 단계 실행 함수
// User의 예약 정보는 Recoil 에 저장하기.
const fetch = async () => {
Expand All @@ -123,6 +136,7 @@ const Step2 = ({ restaurantName, increasePageFunc, decreasePageFunc }) => {
alert('예약을 종료하고 홈 화면으로 돌아갑니다.');
navigate('/district1');
}
sendMsg();
} catch (error) {
return error;
}
Expand Down
6 changes: 6 additions & 0 deletions src/Layouts/Detail/Detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ const Detail = ({ resId }) => {
}
return Restaurant;
};

useEffect(() => {
fetch();
}, []);

useEffect(() => {
window.Kakao.init(process.env.REACT_APP_KAKAO_KEY);
console.log(window.Kakao.isInitialized());
}, []);
return (
<>
<Container>
Expand Down
1 change: 0 additions & 1 deletion src/Layouts/MyReservation/MyReservation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const MyReservation = () => {
try {
// user의 waiting pk 로 waiting 정보 조회 및 저장
const waitingInfo = (await userWaiting(user.username)).data;
console.log(waitingInfo);
if (waitingInfo.data.success) {
setWaitingInfo(waitingInfo);
setWaitingNum(waitingInfo.members.length);
Expand Down

0 comments on commit 102248b

Please sign in to comment.