refactor(api): check if coAuthor form field is an empty string

if it is, set coAuthor in document to null, otherwise, set it to the provided value
This commit is contained in:
parent 696ce44290
commit 18f11f7ca7
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -33,7 +33,7 @@ export default eventHandler(async (ev) => {
const update: Partial<IStory> = {
title: body.title,
completed: body.completed,
coAuthor: body.coAuthor,
coAuthor: !!body.coAuthor ? body.coAuthor : null,
chapters: [],
};
for (const oc of os.chapters) {