diff --git a/packages/adminPage/src/App.jsx b/packages/adminPage/src/App.jsx index 32c60e5..6f2a14d 100644 --- a/packages/adminPage/src/App.jsx +++ b/packages/adminPage/src/App.jsx @@ -30,8 +30,8 @@ function App() { } /> } /> } /> - } /> } /> + } /> } /> } /> diff --git a/packages/adminPage/src/features/users/Users.jsx b/packages/adminPage/src/features/users/Users.jsx index 8f682e5..69c5f6b 100644 --- a/packages/adminPage/src/features/users/Users.jsx +++ b/packages/adminPage/src/features/users/Users.jsx @@ -3,15 +3,15 @@ import { fetchServer } from "@common/dataFetch/fetchServer.js"; import Pagination from "@admin/components/Pagination"; import { useState } from "react"; -export default function Comments({ searchString, category }) { - searchString; +export default function Comments({ searchParams }) { const [page, setPage] = useState(1); const data = useQuery( "admin-users", () => - fetchServer(`/api/v1/admin/event-users?page=${page - 1}&search=${searchString}&size=15`) + fetchServer( + `/api/v1/admin/event-users?page=${page - 1}&search=${searchParams.get("search") ?? ""}&field=${searchParams.get("field") ?? "userName"}&size=15`, + ) .then((res) => { - console.log(category); return res; }) .catch((e) => { @@ -19,7 +19,7 @@ export default function Comments({ searchString, category }) { console.log(e); return { users: [] }; }), - [page, searchString], + [page, searchParams], ); return ( diff --git a/packages/adminPage/src/features/users/index.jsx b/packages/adminPage/src/features/users/index.jsx index bb4afb4..7705508 100644 --- a/packages/adminPage/src/features/users/index.jsx +++ b/packages/adminPage/src/features/users/index.jsx @@ -2,15 +2,19 @@ import Suspense from "@common/components/Suspense"; import Loading from "./Loading.jsx"; import Users from "./Users.jsx"; import { useState } from "react"; +import { useSearchParams } from "react-router-dom"; export default function AdminCommentID() { const [formString, setFormString] = useState(""); const [searchString, setSearchString] = useState(""); - const [category, setCategory] = useState("name"); + const [category, setCategory] = useState("userName"); + + const [searchParams, setSearchParams] = useSearchParams(); function searchComment(e) { e.preventDefault(); setSearchString(formString); + setSearchParams({ search: formString, field: category }); } return ( @@ -37,7 +41,7 @@ export default function AdminCommentID() { onChange={(e) => setCategory(e.target.value)} className="bg-transparent text-neutral-600" > - + @@ -58,7 +62,7 @@ export default function AdminCommentID() { }> - + );