Skip to content

Commit

Permalink
trying fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesq23 committed Nov 19, 2024
1 parent 71d7848 commit c2a81eb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
28 changes: 14 additions & 14 deletions src/app/api/chapter/get-chapters/route.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { getChapters } from "@server/mongodb/actions/Chapter";
import APIWrapper from "@server/utils/APIWrapper";

export const GET = APIWrapper({
config: {
requireToken: true,
requireAdmin: true,
},
handler: async () => {
const chapters = await getChapters();

return chapters;
},
});
import { getChapters } from "@server/mongodb/actions/Chapter";
import APIWrapper from "@server/utils/APIWrapper";

export const GET = APIWrapper({
config: {
requireToken: true,
requireAdmin: true,
},
handler: async () => {
const chapters = await getChapters();

return chapters;
},
});
7 changes: 4 additions & 3 deletions src/components/Search/AdvancedSearch/AdvancedSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@ export const AdvancedSearch = (props: UpdateParamProp) => {
const [chapters, setChapters] = useState<DropdownOption<string>[]>([]);

const loadChapters = useCallback(() => {
}, []);

useEffect(() => {
internalRequest<IChapter[] | null>({
url: "/api/chapter/get-chapters",
method: HttpMethod.GET,
Expand All @@ -325,6 +322,10 @@ export const AdvancedSearch = (props: UpdateParamProp) => {
});
}, []);

useEffect(() => {
loadChapters();
}, [loadChapters]);

return (
<div className={styles.body} style={props.style}>
<div className={styles.button_row}>
Expand Down

0 comments on commit c2a81eb

Please sign in to comment.