refactor(api): pass chapter index to chapterTransformer in individual chaper get route

This commit is contained in:
parent 9ecb93d85d
commit 61c57e4161
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -4,9 +4,10 @@ import storyCheck from "~/lib/server/middlewareButNotReally/storyCheck";
export default eventHandler(async (ev) => {
const story = await storyQuerier(ev);
const chres = await storyCheck(ev, story);
const bi = parseInt(getRouterParam(ev, "chapter")!);
const chres = await storyCheck(ev, story, bi - 1);
if (chres != null) {
throw createError(chres);
}
return await chapterTransformer(story, ev);
return await chapterTransformer(story, ev, bi - 1);
});