Skip to content

Commit

Permalink
[front] Separate room list getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kogepan229 committed Mar 1, 2024
1 parent 005d6a7 commit 7fe0bf6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions next_app/src/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,22 @@ const RoomInfoPanel = async ({ roomId }: { roomId: string }) => {
)
}

const RoomInfoPanelList = async () => {
const getRoomList = async (): Promise<string[]> => {
const con = await getDBConnection()
let [rows, _] = await con.query(`SELECT id FROM rooms`)
con.end()

const data: any[] = JSON.parse(JSON.stringify(rows))

return data.map(v => {
return <RoomInfoPanel roomId={v.id} key={v.id} />
return v.id
})
}

const RoomInfoPanelList = async () => {
const roomList = await getRoomList()

return roomList.map(id => {
return <RoomInfoPanel roomId={id} key={id} />
})
}

Expand Down

0 comments on commit 7fe0bf6

Please sign in to comment.