fix(api): fall back to grabbing the current element's _id in replaceOrUploadContent call

This commit is contained in:
parent 07ed91b2a1
commit f1a5cfffd4
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -47,7 +47,8 @@ export default eventHandler(async (ev) => {
posted: os.chapters[idx].posted, posted: os.chapters[idx].posted,
}); });
} }
await replaceOrUploadContent(os.chapters![idx].id, cont);
await replaceOrUploadContent(os.chapters![idx]?.id ?? c._id, cont);
update.chapters![update.chapters!.length - 1].words = countWords(cont); update.chapters![update.chapters!.length - 1].words = countWords(cont);
} }
os = await Story.findOneAndUpdate( os = await Story.findOneAndUpdate(