瀏覽代碼

feat(web): require page load to export title (#1956)

Michel Heusschen 2 年之前
父節點
當前提交
8857d0b8df
共有 3 個文件被更改,包括 23 次插入3 次删除
  1. 7 1
      web/src/app.d.ts
  2. 7 1
      web/src/routes/(user)/explore/+page.server.ts
  3. 9 1
      web/src/routes/(user)/search/+page.server.ts

+ 7 - 1
web/src/app.d.ts

@@ -8,7 +8,13 @@ declare namespace App {
 		api: import('@api').ImmichApi;
 	}
 
-	// interface Platform {}
+	interface PageData {
+		meta: {
+			title: string;
+			description?: string;
+			imageUrl?: string;
+		};
+	}
 
 	interface Error {
 		message: string;

+ 7 - 1
web/src/routes/(user)/explore/+page.server.ts

@@ -9,5 +9,11 @@ export const load = (async ({ locals, parent }) => {
 
 	const { data: items } = await locals.api.searchApi.getExploreData();
 
-	return { user, items };
+	return {
+		user,
+		items,
+		meta: {
+			title: 'Explore'
+		}
+	};
 }) satisfies PageServerLoad;

+ 9 - 1
web/src/routes/(user)/search/+page.server.ts

@@ -23,5 +23,13 @@ export const load = (async ({ locals, parent, url }) => {
 		undefined,
 		{ params: url.searchParams }
 	);
-	return { user, term, results };
+
+	return {
+		user,
+		term,
+		results,
+		meta: {
+			title: 'Search'
+		}
+	};
 }) satisfies PageServerLoad;