Skip to content

Commit 37d6847

Browse files
Revert "more changes"
This reverts commit 66a5c59.
1 parent ff254f8 commit 37d6847

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/app/questions/page.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,20 @@ const Page = async ({
1717
}: {
1818
searchParams: { page?: string; tag?: string; search?: string };
1919
}) => {
20-
const searchForParams = await searchParams;
21-
const params = {
22-
page: searchForParams?.page || "1",
23-
tag: searchForParams?.tag || "",
24-
search: searchForParams?.search || ""
25-
}
20+
searchParams.page ||= "1";
2621

2722
const queries = [
2823
Query.orderDesc("$createdAt"),
29-
Query.offset((+params?.page - 1) * 25),
24+
Query.offset((+searchParams.page - 1) * 25),
3025
Query.limit(25),
3126
];
3227

33-
if (params.tag) queries.push(Query.equal("tags", params.tag));
34-
if (params.search)
28+
if (searchParams.tag) queries.push(Query.equal("tags", searchParams.tag));
29+
if (searchParams.search)
3530
queries.push(
3631
Query.or([
37-
Query.search("title", params.search),
38-
Query.search("content", params.search),
32+
Query.search("title", searchParams.search),
33+
Query.search("content", searchParams.search),
3934
])
4035
);
4136

0 commit comments

Comments
 (0)