diff --git a/src/pages/PostsPage.jsx b/src/pages/PostsPage.jsx index 6a048dc..ac167be 100644 --- a/src/pages/PostsPage.jsx +++ b/src/pages/PostsPage.jsx @@ -1,4 +1,6 @@ import React from 'react'; +import { useDispatch } from 'react-redux'; +import { useNavigate } from 'react-router-dom'; import Swal from 'sweetalert2'; import BackButton from '../components/common/navBar/BackButton'; @@ -26,62 +28,80 @@ function PostsPage() { confirmButtonText: CONFIRM, cancelButtonText: CANCEL, reverseButtons: true, + }).then((result) => { + if (result.isConfirmed) navigate('/signin'); }); }; + const navigate = useNavigate(); + const dispatch = useDispatch(); + + const imageUrl = JSON.parse(localStorage.getItem('imageUrl')); + const title = JSON.parse(localStorage.getItem('title')); + const category = JSON.parse(localStorage.getItem('category')); + const totalAmount = JSON.parse(localStorage.getItem('totalAmount')); + const maxPeople = JSON.parse(localStorage.getItem('maxPeople')); + const textarea = JSON.parse(localStorage.getItem('textarea')); + + const divisionAmount = (totalAmount / (maxPeople + 1)).toLocaleString(); + return ( -
-
-
+
+
-
- -
- {'프로틴 바/ 다크 초코씨솔트&카라멜넛, 마이프로틴 바'} -
-
{`${'과자/간식/시리얼/빙과'} | ${'20분'}${BEFORE}`}
-
- { - '정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~정말 맛있어요~~~' - } +
+ +
+ +
+
+
+
{title}
+ {/* TODO: 시간 추후 수정 필요 */} +
{`${category} | ${'20분'}${BEFORE}`}
+
{textarea}
-
-
-
+
+
+
{SUM}
-
{`${'20,000'}${WON}`}
-
{DIVISION}
+
{`${totalAmount.toLocaleString()}${WON}`}
+
{DIVISION}
-
+
{ACTUAL_PAYMENT_AMOUNT}
-
{`${'5,000'}${WON}`}
+
{`${divisionAmount}${WON}`}
-
-
{`내 1/${'4'} 부담금`}
-
{`${'5,000'}${WON}`}
+
+
{`내 1/${maxPeople + 1} 부담금`}
+
{`${divisionAmount}${WON}`}
-
-
{`파티원 ${'3'}명의 몫`}
-
{`${'15,000'}${WON}`}
+
+
{`파티원 ${maxPeople}명의 몫`}
+
{`${(totalAmount - totalAmount / maxPeople).toLocaleString()}${WON}`}
-
-
-
{`${SUM} ${'20,000'}${WON}`}
-
{`${ACTUAL_PAYMENT_AMOUNT} ${'5,000'}${WON}`}
+
+
+
{`${SUM} ${totalAmount.toLocaleString()}${WON}`}
+
{`${ACTUAL_PAYMENT_AMOUNT} ${divisionAmount}${WON}`}
-