Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Jan 4, 2024
1 parent 18fbb95 commit 7bd15ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/app/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions src/app/search/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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=')}`);
};
}}
/>
Expand Down

0 comments on commit 7bd15ad

Please sign in to comment.