From 8464a0fd1d2078eadfe74734c32975b6caa61b97 Mon Sep 17 00:00:00 2001 From: fede Date: Sun, 14 Jun 2026 02:24:37 -0300 Subject: [PATCH] fix: correjida llamada para obtener el grupo --- front/src/routes/grupos/[id]/+page.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/front/src/routes/grupos/[id]/+page.ts b/front/src/routes/grupos/[id]/+page.ts index c934f1b..87528b1 100644 --- a/front/src/routes/grupos/[id]/+page.ts +++ b/front/src/routes/grupos/[id]/+page.ts @@ -1,20 +1,16 @@ import { redirect } from '@sveltejs/kit'; -import { obtenerGrupos } from '$lib/api'; +import { obtenerGrupo } from '$lib/api'; import type { Grupo } from '../../../types'; import type { PageLoad } from './$types'; -export const load: PageLoad = async ({ params }) => { +export const load: PageLoad = async ({ params, fetch }) => { const id = Number(params.id); - let grupos: Grupo[]; + let grupo: Grupo; try { - grupos = await obtenerGrupos(); + grupo = await obtenerGrupo(id, fetch); } catch { - throw redirect(302, '/'); - } - const grupo = grupos.find((g) => g.id === id) ?? null; - if (!grupo) { - throw redirect(302, '/grupos'); + throw redirect(302, '/menu'); } return { grupo };