We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c84568f commit 664bb26Copy full SHA for 664bb26
src/routes/+page.server.ts
@@ -1,5 +1,10 @@
1
import { redirect } from "@sveltejs/kit";
2
3
-export function load() {
4
- redirect(307, "/packages");
+export async function load({ parent }) {
+ 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}`);
10
}
0 commit comments