From 7bd15adcc7282bd498ed9c3088a0b0d710637cf4 Mon Sep 17 00:00:00 2001 From: yoshinorin Date: Thu, 4 Jan 2024 14:11:09 +0900 Subject: [PATCH] update --- src/app/search/page.tsx | 8 ++++---- src/app/search/renderer.tsx | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx index 1e9852e..5b4664b 100644 --- a/src/app/search/page.tsx +++ b/src/app/search/page.tsx @@ -22,7 +22,7 @@ async function get(req: any) { if (req.searchParams['q'] === undefined) { return { props: { - slug: req.params.slug.join('/'), + slug: 'search', statusCode: req.res.statusCode, hits: 0, count: 0, @@ -36,7 +36,7 @@ async function get(req: any) { const result = await execute(req, qs); return { props: { - slug: req.params.slug.join('/'), + slug: 'search', statusCode: 422, // TODO hits: result.count, count: result.contents.length, @@ -47,7 +47,7 @@ async function get(req: any) { } else { return { props: { - slug: req.params.slug.join('/'), + slug: 'search', statusCode: 422, // TODO hits: 0, count: 0, @@ -59,7 +59,7 @@ async function get(req: any) { } catch { return { props: { - slug: req.params.slug.join('/'), + slug: 'search', statusCode: 422, // TODO hits: 0, count: 0, diff --git a/src/app/search/renderer.tsx b/src/app/search/renderer.tsx index 8467fcf..ca407c2 100644 --- a/src/app/search/renderer.tsx +++ b/src/app/search/renderer.tsx @@ -79,10 +79,7 @@ export const Renderer: React.FunctionComponent<{ }} onKeyDown={(e) => { if (e.key === 'Enter') { - // query: {q :searchWord.split(' ')} - // router.push("/search", { query: {q: searchWord.split(' ')} }); - // router.push("/search", { searchParams: {q: searchWord.split(' ')} }); - router.push("/search?q=test"); + router.push(`/search?q=${searchWord.split(' ').join('&q=')}`); }; }} />