From e9d489f5b5180f501322cdcedcd8fef0991a7d20 Mon Sep 17 00:00:00 2001 From: qwertyforce <44163887+qwertyforce@users.noreply.github.com> Date: Wed, 20 Jan 2021 21:19:54 +0300 Subject: [PATCH] Update show.tsx --- pages/show.tsx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pages/show.tsx b/pages/show.tsx index 7fd427a..0389d07 100644 --- a/pages/show.tsx +++ b/pages/show.tsx @@ -4,10 +4,18 @@ import AppBar from '../components/AppBar' import db_ops from '../server/helpers/db_ops' import Photo from '../components/Photo' import ErrorPage from 'next/error' +interface Photo{ + src:string, + key: string, + width: number, + height: number +} +interface ShowProps{ + photos:Photo[], + err:boolean +} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export default function Show(props: any) { +export default function Show(props: ShowProps) { if (props.err) { return } @@ -30,13 +38,13 @@ export async function getServerSideProps(context: any) { const img_data = await db_ops.image_ops.find_image_by_id(parseInt(id)) if(img_data[0]){images.push(img_data[0])} } - const photos = [] + const photos:Photo[] = [] for (const image of images) { photos.push({ src: `/thumbnails/${image.id}.jpg`, key: `/image/${image.id}`, - width: image.width, - height: image.height + width: image.width as number, + height: image.height as number }) } if(photos.length!==0){