2022-08-26 05:06:39 +00:00
|
|
|
import { error } from '@sveltejs/kit';
|
2023-06-27 23:41:45 +00:00
|
|
|
import prisma from '$lib/prisma.js';
|
2022-08-29 03:48:29 +00:00
|
|
|
import { boardGameApi } from '../../api';
|
2022-04-20 02:15:46 +00:00
|
|
|
|
2023-06-27 23:41:45 +00:00
|
|
|
export const load = async ({ params, setHeaders, locals }) => {
|
|
|
|
|
try {
|
|
|
|
|
const { user } = locals;
|
|
|
|
|
const { id } = params;
|
|
|
|
|
const game = await prisma.game.findUnique({
|
|
|
|
|
where: {
|
|
|
|
|
id
|
|
|
|
|
}
|
2022-12-25 18:52:36 +00:00
|
|
|
});
|
2023-06-27 23:41:45 +00:00
|
|
|
console.log('found game', game);
|
2022-12-25 18:52:36 +00:00
|
|
|
return {
|
2023-06-27 23:41:45 +00:00
|
|
|
game,
|
|
|
|
|
user
|
2022-12-25 18:52:36 +00:00
|
|
|
};
|
2023-06-27 23:41:45 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
2022-12-25 18:52:36 +00:00
|
|
|
}
|
2022-04-20 02:15:46 +00:00
|
|
|
|
2023-06-27 23:41:45 +00:00
|
|
|
throw error(404, 'not found');
|
2022-07-28 00:05:54 +00:00
|
|
|
};
|