Revert "Merge pull request #15 from neynarxyz/shreyas-formatting"

This reverts commit b1fdfc19a9, reversing
changes made to b9e2087bd8.
This commit is contained in:
Shreyaschorge
2025-07-16 17:21:12 +05:30
parent 349cdea489
commit 0d43b35c28
72 changed files with 1065 additions and 6257 deletions

View File

@@ -4,21 +4,18 @@ export async function GET(request: Request) {
const apiKey = process.env.NEYNAR_API_KEY;
const { searchParams } = new URL(request.url);
const fid = searchParams.get('fid');
if (!apiKey) {
return NextResponse.json(
{
error:
'Neynar API key is not configured. Please add NEYNAR_API_KEY to your environment variables.',
},
{ status: 500 },
{ error: 'Neynar API key is not configured. Please add NEYNAR_API_KEY to your environment variables.' },
{ status: 500 }
);
}
if (!fid) {
return NextResponse.json(
{ error: 'FID parameter is required' },
{ status: 400 },
{ status: 400 }
);
}
@@ -27,28 +24,23 @@ export async function GET(request: Request) {
`https://api.neynar.com/v2/farcaster/user/best_friends?fid=${fid}&limit=3`,
{
headers: {
'x-api-key': apiKey,
"x-api-key": apiKey,
},
},
}
);
if (!response.ok) {
throw new Error(`Neynar API error: ${response.statusText}`);
}
const { users } = (await response.json()) as {
users: { user: { fid: number; username: string } }[];
};
const { users } = await response.json() as { users: { user: { fid: number; username: string } }[] };
return NextResponse.json({ bestFriends: users });
} catch (error) {
console.error('Failed to fetch best friends:', error);
return NextResponse.json(
{
error:
'Failed to fetch best friends. Please check your Neynar API key and try again.',
},
{ status: 500 },
{ error: 'Failed to fetch best friends. Please check your Neynar API key and try again.' },
{ status: 500 }
);
}
}
}