Skip to content

Commit

Permalink
YIPPEE
Browse files Browse the repository at this point in the history
  • Loading branch information
suxls committed Oct 3, 2024
1 parent 715d121 commit eef2133
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 19 additions & 3 deletions apps/web/src/app/_components/search/search-filter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use client";

import { useCallback } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
Expand All @@ -22,10 +24,24 @@ export default function SearchFilter() {
},
});

function onSubmit(values: z.infer<typeof formSchema>) {
//value is user's search info
const searchParams = useSearchParams()!;

Check failure on line 27 in apps/web/src/app/_components/search/search-filter.tsx

View workflow job for this annotation

GitHub Actions / lint

This assertion is unnecessary since it does not change the type of the expression

Check failure on line 27 in apps/web/src/app/_components/search/search-filter.tsx

View workflow job for this annotation

GitHub Actions / lint

Forbidden non-null assertion
const router = useRouter();
const pathName = usePathname();

console.log(values);
const createQueryString = useCallback(
(name: string, value: string) => {
const params = new URLSearchParams(searchParams);
params.set(name, value);
return params.toString();
},
[searchParams],
);

function onSubmit(values: z.infer<typeof formSchema>) {
// console.log(searchParams.get("search")); query the user search info
router.push(
pathName + `/?${createQueryString("search", values.searchText)}`,
);
}

return (
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/router/role.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { TRPCRouterRecord } from "@trpc/server";
import Fuse from "fuse.js";

Check failure on line 2 in packages/api/src/router/role.ts

View workflow job for this annotation

GitHub Actions / lint

'Fuse' is defined but never used. Allowed unused vars must match /^_/u
import { z } from "zod";

import { desc, eq } from "@cooper/db";
Expand Down

0 comments on commit eef2133

Please sign in to comment.