@@ -2,11 +2,12 @@ import { useEffect, useState } from "react";
2
2
import type { ColumnDef } from "@tanstack/react-table" ;
3
3
import dayjs from "dayjs" ;
4
4
import styled from "styled-components" ;
5
+ import { getCheckList } from "@/api" ;
5
6
import { SpacerSkleton } from "@/components/common/spacer" ;
6
7
import { Table } from "@/components/common/table" ;
7
8
import Typography from "@/components/common/text/Typography" ;
8
9
import { DeleteAdmin } from "./deleteAdmin" ;
9
- import { mockRes , displayedStatus } from "../data" ;
10
+ import { displayedStatus } from "../data" ;
10
11
11
12
const column : ColumnDef < any > [ ] = [
12
13
{ id : "id" , header : "번호" , accessorFn : ( row ) => row . id , size : 28 } ,
@@ -53,31 +54,37 @@ export function EnrollmentCheckTable() {
53
54
useEffect ( ( ) => {
54
55
const updated : any [ ] = [ ] ;
55
56
56
- const { data } = mockRes ;
57
+ ( async ( ) => {
58
+ const { data } = await getCheckList ( ) ;
57
59
58
- data . forEach ( ( work ) => {
59
- const { schedules, ...rest } = work ;
60
+ data . forEach ( ( work ) => {
61
+ const { schedules, ...rest } = work ;
60
62
61
- schedules . forEach ( ( schedule ) => {
62
- const { id, leftSeatCount, seatMaxCount } = schedule ;
63
+ schedules . forEach ( ( schedule ) => {
64
+ const { id, leftSeatCount, seatMaxCount } = schedule ;
63
65
64
- const row = {
65
- id,
66
- created_at : dayjs ( rest . createdAt ) . format ( "YYYY.MM.DD" ) ,
67
- genre : rest . genre ,
68
- title : rest . title ,
69
- createdBy : rest . createdBy ,
70
- status : displayedStatus [ rest . status ] ,
71
- selling : `${ leftSeatCount } /${ seatMaxCount } ` ,
72
- } ;
66
+ const row = {
67
+ id,
68
+ created_at : dayjs ( rest . createdAt ) . format ( "YYYY.MM.DD" ) ,
69
+ genre : rest . genre ,
70
+ title : rest . title ,
71
+ createdBy : rest . createdBy ,
72
+ status : displayedStatus [ rest . status ] ,
73
+ selling : `${ leftSeatCount } /${ seatMaxCount } ` ,
74
+ } ;
73
75
74
- updated . push ( row ) ;
75
- } ) ;
76
+ updated . push ( row ) ;
77
+ } ) ;
76
78
77
- setList ( updated ) ;
78
- } ) ;
79
+ setList ( updated ) ;
80
+ } ) ;
81
+ } ) ( ) ;
79
82
} , [ ] ) ;
80
83
84
+ if ( list . length === 0 ) {
85
+ return ;
86
+ }
87
+
81
88
return (
82
89
< SpacerSkleton id = "main-content" type = "vertical" gap = { 44 } >
83
90
< div >
0 commit comments