euh lots of changes nothing works ahhh
This commit is contained in:
parent
95d8988876
commit
36b937c5b6
246 changed files with 1758 additions and 1443 deletions
|
@ -0,0 +1,31 @@
|
|||
import { getCompetition } from '@/lib/server/db/queries/competitions';
|
||||
import { getRound } from '@/lib/server/db/queries/rounds';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, locals }) => {
|
||||
const competitionId = params.id;
|
||||
const roundId = params.round_id;
|
||||
const { user } = locals;
|
||||
if (!user) {
|
||||
throw new Error('Unauthorized');
|
||||
}
|
||||
if (competitionId === '') {
|
||||
throw new Error('Invalid competition id');
|
||||
}
|
||||
if (roundId === '') {
|
||||
throw new Error('Invalid round id');
|
||||
}
|
||||
|
||||
const competition = await getCompetition(competitionId);
|
||||
if (!competition) {
|
||||
throw new Error('Invalid competition');
|
||||
}
|
||||
if (competition.owner !== locals.user.id) {
|
||||
throw new Error('Unauthorized');
|
||||
}
|
||||
const round = await getRound(competitionId, roundId);
|
||||
if (!round) {
|
||||
throw new Error('Invalid round');
|
||||
}
|
||||
return { competition: competition, round };
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
<script lang="ts">
|
||||
import type { PageProps } from './$types';
|
||||
|
||||
let { data }: PageProps = $props();
|
||||
</script>
|
||||
|
||||
{JSON.stringify(data)}
|
Loading…
Add table
Add a link
Reference in a new issue