From 930d1b109d084c98f5f3dbc45ac680f1f0ee0fef Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 4 Jan 2024 22:33:36 -0300 Subject: [PATCH] sitio: corregir types --- sitio/src/routes/+page.server.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sitio/src/routes/+page.server.ts b/sitio/src/routes/+page.server.ts index 0fd646d..fb92f70 100644 --- a/sitio/src/routes/+page.server.ts +++ b/sitio/src/routes/+page.server.ts @@ -3,9 +3,17 @@ import { db, schema } from "$lib/server/db"; const { precios } = schema; import { sql } from "drizzle-orm"; -let cache: null | { key: Date; data: PageData } = null; +let cache: null | { key: Date; data: { precios: Precios } } = null; -export const load: PageServerLoad = async ({ params }) => { +type Precios = { + ean: string; + name: string | null; + imageUrl: string | null; +}[]; + +export const load: PageServerLoad = async ({ + params, +}): Promise<{ precios: Precios }> => { if (cache && +new Date() < +cache.key + 1000 * 60 * 10) { return cache.data; }