Skip to content
Permalink
Browse files

feat($core): handle uncreated page

  • Loading branch information...
ulivz committed Feb 7, 2019
1 parent 8809986 commit 56654832c4be200eb1fb691f57df7c0f885ce61b
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/index.js
@@ -50,7 +50,6 @@ module.exports = (opts, ctx) => {
repoId = targetRepo.id
}

console.log(repoId)
Yuque.setRepoId(repoId)
const yuque = Yuque.getInstance()

@@ -106,8 +105,15 @@ module.exports = (opts, ctx) => {

spinner.start(`Fetching ${chalk.cyan(title)} ... `)

const post = await yuque.getPage(slug)
const postContent = post.data.body
const { status, data } = await yuque.getPage(slug)
let postContent
debug(status)
if (status && status === 404) {
postContent = `# ${title}\n > 此文档尚未创建`
} else {
postContent = data.body
}

const {
data: frontmatter,
content: strippedContent

0 comments on commit 5665483

Please sign in to comment.
You can’t perform that action at this time.