Skip to content

Commit

Permalink
Merge pull request #148 from softeerbootcamp4th/feature/122-admin-user
Browse files Browse the repository at this point in the history
[fix] 어드민 기대평 검색에서 새 문자열 검색 시 페이지 1로 초기화
  • Loading branch information
lybell-art authored Aug 26, 2024
2 parents 9995e8d + b3a3db0 commit 51ecd93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/adminPage/src/features/comment/id/Comments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import { useQuery } from "@common/dataFetch/getQuery.js";
import { fetchServer } from "@common/dataFetch/fetchServer.js";
import { formatDate } from "@common/utils.js";
import Pagination from "@admin/components/Pagination";
import { useState } from "react";

export default function Comments({
eventId,
checkedComments,
setCheckedComments,
setAllId,
searchString,
page,
setPage
}) {
const [page, setPage] = useState(1);

const data = useQuery(
eventId,
() =>
Expand Down
4 changes: 4 additions & 0 deletions packages/adminPage/src/features/comment/id/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function AdminCommentID({ eventId }) {
const [formString, setFormString] = useState("");
const [searchString, setSearchString] = useState("");
const [allId, setAllId] = useState([]);
const [page, setPage] = useState(1);

function selectAll() {
if (allId.every((id) => checkedComments.has(id))) {
Expand All @@ -26,6 +27,7 @@ export default function AdminCommentID({ eventId }) {

function searchComment(e) {
e.preventDefault();
setPage(1);
setSearchString(formString);
}

Expand Down Expand Up @@ -78,6 +80,8 @@ export default function AdminCommentID({ eventId }) {
setCheckedComments={setCheckedComments}
setAllId={setAllId}
searchString={searchString}
page={page}
setPage={setPage}
/>
</Suspense>
</div>
Expand Down

0 comments on commit 51ecd93

Please sign in to comment.