2023-05-15 04:08:30 +00:00
|
|
|
import { superValidate } from 'sveltekit-superforms/server';
|
|
|
|
|
import { search_schema } from '$lib/zodValidation';
|
2023-09-14 00:08:54 +00:00
|
|
|
import type { MetaTagsProps } from 'svelte-meta-tags';
|
2022-09-29 22:22:01 +00:00
|
|
|
|
2023-05-15 04:08:30 +00:00
|
|
|
export const load = async ({ fetch, url }) => {
|
2023-09-14 23:53:27 +00:00
|
|
|
const image = {
|
|
|
|
|
url: `${
|
|
|
|
|
new URL(url.pathname, url.origin).href
|
|
|
|
|
}og?header=Bored Game&page=Home&content=Keep track of your games`,
|
|
|
|
|
width: 1200,
|
|
|
|
|
height: 630
|
|
|
|
|
};
|
2023-09-14 00:08:54 +00:00
|
|
|
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',
|
2023-09-14 23:53:27 +00:00
|
|
|
images: [image],
|
|
|
|
|
siteName: 'Bored Game'
|
|
|
|
|
},
|
|
|
|
|
twitter: {
|
|
|
|
|
handle: '@boredgame',
|
|
|
|
|
site: '@boredgame',
|
|
|
|
|
cardType: 'summary_large_image',
|
|
|
|
|
title: 'Home | Bored Game',
|
|
|
|
|
description: 'Bored Game, keep track of your games',
|
|
|
|
|
image: `${
|
|
|
|
|
new URL(url.pathname, url.origin).href
|
|
|
|
|
}og?header=Bored Game&page=Home&content=Keep track of your games`,
|
|
|
|
|
imageAlt: 'Home | Bored Game'
|
2023-09-14 00:08:54 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2023-05-15 04:08:30 +00:00
|
|
|
const formData = Object.fromEntries(url?.searchParams);
|
2023-05-29 06:34:39 +00:00
|
|
|
console.log('formData', formData);
|
2023-05-15 04:08:30 +00:00
|
|
|
formData.name = formData?.q;
|
|
|
|
|
const form = await superValidate(formData, search_schema);
|
2023-05-29 06:34:39 +00:00
|
|
|
console.log('form', form);
|
2023-09-14 00:08:54 +00:00
|
|
|
return { form, metaTagsChild: metaTags };
|
2023-05-15 04:08:30 +00:00
|
|
|
};
|
|
|
|
|
|
2023-07-30 05:00:51 +00:00
|
|
|
// export const actions = {
|
|
|
|
|
// default: async ({ request, locals }): Promise<any> => {
|
|
|
|
|
// // Do things in here
|
|
|
|
|
// return {};
|
|
|
|
|
// }
|
|
|
|
|
// };
|