import { fetchAll } from '@/lib/api/feed/feed';
import FeedList from '../_component/FeedList';
import FeedTabs from '../_component/FeedTabs';
import FeedWriteButton from '../_component/FeedWriteButton';

export default async function FeedAllPage() {
	const res = await fetchAll(1, 20);
	const data = res.data ?? { total: 0, list: [] };

	return (
		<>
			<header className="feed__header">
				<FeedTabs />
				<FeedWriteButton />
			</header>

			<FeedList
				initialCards={data.list}
				initialTotal={data.total}
				endpoint="/api/feed/all"
				emptyMessage="아직 게시물이 없습니다."
			/>
		</>
	);
}
