boredgame/src/routes/(app)/+page.server.ts

41 lines
1.1 KiB
TypeScript
Raw Normal View History

import { superValidate } from 'sveltekit-superforms/server';
import { search_schema } from '$lib/zodValidation';
import type { MetaTagsProps } from 'svelte-meta-tags';
2022-09-29 22:22:01 +00:00
export const load = async ({ fetch, url }) => {
const metaTags: MetaTagsProps = Object.freeze({
title: 'Home',
description: 'Home page',
openGraph: {
type: 'website',
url: new URL(url.pathname, url.origin).href,
locale: 'en_US',
title: 'Home',
2023-09-14 01:43:22 +00:00
description: 'Bored Game, keep track of your games',
images: [
{
2023-09-14 05:52:34 +00:00
url: `${
new URL(url.pathname, url.origin).href
}og?title=Home | Bored Game&description=Bored Game, keep track of your games`,
2023-09-14 01:43:22 +00:00
width: 1200,
height: 630
}
]
}
});
const formData = Object.fromEntries(url?.searchParams);
console.log('formData', formData);
formData.name = formData?.q;
const form = await superValidate(formData, search_schema);
console.log('form', form);
return { form, metaTagsChild: metaTags };
};
// export const actions = {
// default: async ({ request, locals }): Promise<any> => {
// // Do things in here
// return {};
// }
// };