Skip to content

Commit

Permalink
Refactor: Transfer productId from Order to Review (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
heeoneie authored Dec 5, 2023
1 parent 2070df7 commit b13b560
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/component/order/OrderTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function a11yProps(index) {
};
}

export default function OrderTab({ content }) {
export default function OrderTab({ content, productId }) {
const [value, setValue] = useState(0);

const handleChange = (event, newValue) => {
Expand All @@ -57,7 +57,7 @@ export default function OrderTab({ content }) {
{
value: 'review',
label: '리뷰',
content: <Review />,
content: <Review productId={productId} />,
},
];

Expand Down
4 changes: 2 additions & 2 deletions src/component/order/review/Review.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ReviewContent } from './ReviewContent';
import ReviewPages from './ReviewPages';
import { getReview } from '../../../axios/order/Review';

export default function Review() {
export default function Review({ productId }) {
const [onlyPhoto, setOnlyPhoto] = useState(false);
const [reviewContents, setReviewContents] = useState([]);
const [pages, setPages] = useState({
Expand All @@ -22,7 +22,7 @@ export default function Review() {
}, [onlyPhoto, pageNum]);

function getReviewFromServer() {
getReview('LIB-001', 10, pageNum, onlyPhoto).then((res) => {
getReview(productId, 10, pageNum, onlyPhoto).then((res) => {
const contents = res.contents;
setReviewContents([]);
for (var i = 0; i < contents.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/screen/order/Order.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const Order = () => {
/>
</div>
</div>
<OrderTab content={productInfo.content} />
<OrderTab content={productInfo.content} productId={productId} />
<Footer />
</div>
);
Expand Down

0 comments on commit b13b560

Please sign in to comment.