@@ -65,9 +65,11 @@ function PriceMainPage() {
65
65
66
66
const currentDate = new Date ( ) ;
67
67
const currentYear = currentDate . getFullYear ( ) ;
68
- const currentMonth = String ( currentDate . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) ; // 현재 월 (0부터 시작하므로 +1)
68
+ const currentMonth = String ( currentDate . getMonth ( ) ) . padStart ( 2 , "0" ) ; // 현재 월 (0부터 시작하므로 +1)
69
69
const currentSuffix = `_${ currentYear } ${ currentMonth } ` ;
70
70
71
+ console . log ( currentSuffix ) ;
72
+
71
73
useEffect ( ( ) => {
72
74
const fetchPrice = async ( ) => {
73
75
if ( ! user ) {
@@ -126,17 +128,20 @@ function PriceMainPage() {
126
128
< PriceWrapper >
127
129
{ Array . isArray ( price . products ) &&
128
130
price . products
129
- . filter ( ( item ) => item . product_id . endsWith ( currentSuffix ) ) // 현재 달 데이터만 필터링
130
- . map ( ( item ) => (
131
- < PriceItem
132
- key = { item . product_id }
133
- product_id = { item . product_id } // product_id 수정 불필요
134
- product_name = { item . product_name }
135
- current_month_price = { item . current_month_price }
136
- previous_month_price = { item . previous_month_price }
137
- previous_two_months_price = { item . previous_two_months_price }
138
- />
139
- ) ) }
131
+ . filter ( ( item ) => item . product_id . endsWith ( currentSuffix ) )
132
+ . map ( ( item ) => {
133
+ console . log ( "Filtered Product:" , item ) ;
134
+ return (
135
+ < PriceItem
136
+ key = { item . product_id }
137
+ product_id = { item . product_id }
138
+ product_name = { item . product_name }
139
+ current_month_price = { item . current_month_price }
140
+ previous_month_price = { item . previous_month_price }
141
+ previous_two_months_price = { item . previous_two_months_price }
142
+ />
143
+ ) ;
144
+ } ) }
140
145
</ PriceWrapper >
141
146
</ Container >
142
147
) ;
0 commit comments