Skip to content

Commit

Permalink
lint/cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
karamba228 committed Feb 7, 2025
1 parent 70fc227 commit 37e704d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
13 changes: 4 additions & 9 deletions src/app/[ecosystem]/[...packageName]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@ export default async function PackageScoreComponent({ params }: Props) {
const { ecosystem, packageName } = await params;
const name = packageName.join("/");

const notes = await fetchNotes();
let packageData;

try {
packageData = await fetchPackageScore(ecosystem, name);
} catch (error) {
throw error;
}
const { package: pkg, status, score, source } = packageData;
const [notes, { package: pkg, status, score, source }] = await Promise.all([
fetchNotes(),
fetchPackageScore(ecosystem, name),
]);

if (status === "not_found") {
notFound();
Expand Down
5 changes: 1 addition & 4 deletions src/utils/score_res.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,8 @@ export async function fetchPackageScore(
ecosystem: string,
name: string,
): Promise<PackageScore> {

if (!(ecosystem in ({} as EcosystemDestination))) {
throw new Error(
`Invalid ecosystem: "${ecosystem}".`
);
throw new Error(`Invalid ecosystem: "${ecosystem}".`);
}
const url = `${BASE_URL}/score/${ecosystem.toLowerCase()}/${name}`;
console.debug(url);
Expand Down

0 comments on commit 37e704d

Please sign in to comment.