Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m41s
test / unit (pull_request) Successful in 16m33s
test / integration (pull_request) Failing after 17m3s
34 lines
941 B
TypeScript
34 lines
941 B
TypeScript
import { cookies } from "next/headers";
|
|
import { notFound } from "next/navigation";
|
|
import { getFollowersList } from "@/lib/api";
|
|
import { UserListCard } from "@/components/user-list-card";
|
|
|
|
interface FollowersPageProps {
|
|
params: Promise<{ username: string }>;
|
|
}
|
|
|
|
export default async function FollowersPage({ params }: FollowersPageProps) {
|
|
const { username } = await params;
|
|
const token = (await cookies()).get("auth_token")?.value ?? null;
|
|
|
|
const followersData = await getFollowersList(username, token).catch(
|
|
() => null
|
|
);
|
|
|
|
if (!followersData) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<div className="container mx-auto max-w-2xl p-4 sm:p-6">
|
|
<header className="my-6">
|
|
<h1 className="text-3xl font-bold">Followers</h1>
|
|
<p className="text-muted-foreground">Users following @{username}.</p>
|
|
</header>
|
|
<main>
|
|
<UserListCard users={followersData.items} />
|
|
</main>
|
|
</div>
|
|
);
|
|
}
|