page.tsx 829 B

1234567891011121314151617181920212223242526
  1. import { fetchJson } from '@/lib/utils/server';
  2. import type { LiveChannelListResponse } from '@/types/response/channel/live-list';
  3. import LiveExplorer from './LiveExplorer';
  4. import '../_components/home.scss';
  5. import './live.scss';
  6. const PAGE_SIZE = 24;
  7. export const metadata = {
  8. title: '생방송'
  9. };
  10. export default async function LivePage()
  11. {
  12. const res = await fetchJson<LiveChannelListResponse>(`/api/channel/live-list?limit=${PAGE_SIZE}&offset=0&sort=viewers`, { method: 'GET' });
  13. const initialChannels = res.success && res.data ? res.data.channels : [];
  14. const initialTotal = res.success && res.data ? res.data.total : 0;
  15. return (
  16. <div className="home">
  17. <div className="home__inner">
  18. <LiveExplorer initialChannels={initialChannels} initialTotal={initialTotal} pageSize={PAGE_SIZE} />
  19. </div>
  20. </div>
  21. );
  22. }