diff --git a/components/EmptyImage.tsx b/components/EmptyImage.tsx new file mode 100644 index 000000000..bdcf9133d --- /dev/null +++ b/components/EmptyImage.tsx @@ -0,0 +1,17 @@ +import NotiEmptyEmoji from 'public/image/noti_empty.svg'; +import styles from 'styles/EmptyImage.module.scss'; + +function EmptyImage() { + return ( +
+
+
+
+
+
+ +
+ ); +} + +export default EmptyImage; diff --git a/components/store/InventoryItem.tsx b/components/store/InventoryItem.tsx index a93676a22..4fb215976 100644 --- a/components/store/InventoryItem.tsx +++ b/components/store/InventoryItem.tsx @@ -82,7 +82,12 @@ export function InvetoryItem({ item }: inventoryItemProps) {
- {itemName} + {itemName}
{itemName}
diff --git a/components/store/InventoryList.tsx b/components/store/InventoryList.tsx index 8fbfdf0a0..d94c82a6e 100644 --- a/components/store/InventoryList.tsx +++ b/components/store/InventoryList.tsx @@ -1,12 +1,13 @@ import React from 'react'; +import { instance } from 'utils/axios'; import { InfinityScroll } from 'utils/infinityScroll'; -import { mockInstance } from 'utils/mockAxios'; +import EmptyImage from 'components/EmptyImage'; import { InfiniteScrollComponent } from 'components/store/InfiniteScrollComponent'; import { InvetoryItem } from 'components/store/InventoryItem'; import styles from 'styles/store/Inventory.module.scss'; function fetchInventoryData(page: number) { - return mockInstance.get(`items?page=${page}&size=${8}`).then((res) => { + return instance.get(`/pingpong/items?page=${page}&size=${8}`).then((res) => { return res.data; }); } @@ -23,20 +24,27 @@ export function InventoryList() { if (error) return
{error.message}
; if (!data) return
No data
; + if (data.pages[0].storageItemList.length === 0) { + return ( +
+

+ 보유한 아이템이 없습니다. +
상점 탭에서 아이템을 구입해 보세요! +

+ +
+ ); + } + return (
{data.pages.map((page, pageIndex) => ( - {page.storageItemList.length === 0 ? ( -
- 보유한 아이템이 없습니다. -
상점 탭에서 아이템을 구입해 보세요! -
- ) : ( - page.storageItemList.map((item) => ( - - )) - )} + {page.storageItemList.length === 0 + ? null + : page.storageItemList.map((item) => ( + + ))}
))}