Skip to content

Commit 664bb26

Browse files
feat(frontend): redirect to first package from home page instead of list
1 parent c84568f commit 664bb26

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/routes/+page.server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { redirect } from "@sveltejs/kit";
22

3-
export function load() {
4-
redirect(307, "/packages");
3+
export async function load({ parent }) {
4+
const { displayablePackages } = await parent();
5+
const firstCategory = displayablePackages[0];
6+
if (!firstCategory) redirect(307, "/packages");
7+
const firstPackage = firstCategory.packages[0];
8+
if (!firstPackage) redirect(307, "/packages");
9+
redirect(307, `/package/${firstPackage.packageName}`);
510
}

0 commit comments

Comments
 (0)