refactor(api): update function calls
This commit is contained in:
parent
ff4b94d913
commit
d056dac72b
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user