Skip to content

Commit

Permalink
fix: add default value for isShowcased
Browse files Browse the repository at this point in the history
  • Loading branch information
banzhe committed Nov 18, 2024
1 parent e28c840 commit 1cdbb3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/server/src/api/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ app.post(
return c.json(result.error(400, 'FolderId id should be a number'))
}

if (!value.isShowcased || !isNumberString(value.isShowcased)) {
if (isNotNil(value.isShowcased) && !isNumberString(value.isShowcased)) {
return c.json(result.error(400, 'isShowcased is required'))
}

Expand All @@ -55,7 +55,7 @@ app.post(
folderId: Number(value.folderId),
screenshot: value.screenshot,
bindTags: JSON.parse(value.bindTags ?? '[]') as string[],
isShowcased: Boolean(Number(value.isShowcased)),
isShowcased: Boolean(Number(value.isShowcased ?? 0)),
}
}),
async (c) => {
Expand Down

0 comments on commit 1cdbb3a

Please sign in to comment.