page.tsx 637 B

1234567891011121314151617181920212223
  1. import CryptoPageContent from '@/app/component/crypto/CryptoPageContent';
  2. import { fetchJson } from '@/lib/utils/server';
  3. import type { ResultDto } from '@/types/response/common';
  4. import type { TickerRestData } from '@/types/crypto';
  5. export default async function Home() {
  6. let initialTickers: TickerRestData[] = [];
  7. try {
  8. const res: ResultDto<TickerRestData[]> = await fetchJson('/api/crypto/tickers?quote=KRW', {
  9. method: 'GET',
  10. });
  11. if (res.success && res.data) {
  12. initialTickers = res.data;
  13. }
  14. } catch {
  15. // 백엔드 미연결 시 빈 배열
  16. }
  17. return (
  18. <CryptoPageContent initialTickers={initialTickers} />
  19. );
  20. }