refactor(api): update function calls

This commit is contained in:
parent ff4b94d913
commit d056dac72b
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C
2 changed files with 68 additions and 68 deletions

@ -3,7 +3,7 @@ import { countWords } from "~/lib/functions";
import storyQuerier from "~/lib/server/dbHelpers/storyQuerier"; import storyQuerier from "~/lib/server/dbHelpers/storyQuerier";
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn"; import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
import { canModify } from "~/lib/server/middlewareButNotReally/storyPrivileges"; import { canModify } from "~/lib/server/middlewareButNotReally/storyPrivileges";
import { replaceContent, bodyHandler } from "~/lib/server/storyHelpers"; import { replaceOrUploadContent, bodyHandler } from "~/lib/server/storyHelpers";
import { Story } from "~/models/stories"; import { Story } from "~/models/stories";
export default eventHandler(async (ev) => { export default eventHandler(async (ev) => {
@ -19,7 +19,7 @@ export default eventHandler(async (ev) => {
const cc: FormChapter = body.chapters[0]; const cc: FormChapter = body.chapters[0];
const cid = story.chapters[ev.context.chapterIndex].id; const cid = story.chapters[ev.context.chapterIndex].id;
const content = await bodyHandler(cc); const content = await bodyHandler(cc);
await replaceContent(cid!, content); await replaceOrUploadContent(cid!, content);
let ns; let ns;
try { try {
ns = await Story.findOneAndUpdate( ns = await Story.findOneAndUpdate(