portfolio_site/src/routes/(games)/+layout.server.ts

21 lines
337 B
TypeScript
Raw Normal View History

import type { LayoutServerData } from './$types';
import { games } from '$lib/config';
export const load: LayoutServerData = async ({ url }) => {
2025-01-22 14:25:24 +02:00
if (!url?.pathname) {
return;
}
2025-01-22 14:25:24 +02:00
const game = games[url.pathname];
2025-01-22 14:25:24 +02:00
if (!game) {
return;
}
2025-01-22 14:25:24 +02:00
return {
name: game.name,
description: game.description,
image: game.image
};
};