check return type from gun
This commit is contained in:
parent
0be779b73c
commit
d0349669f9
1 changed files with 18 additions and 13 deletions
|
|
@ -1274,10 +1274,12 @@ const createPost = async (tags, title, content) => {
|
|||
|
||||
let pageIdx = Math.max(0, numOfPages - 1).toString()
|
||||
|
||||
const count =
|
||||
numOfPages === 0
|
||||
? 0
|
||||
: /** @type {number} */ (await Utils.tryAndWait(
|
||||
const count = await (async () => {
|
||||
if (numOfPages === 0) {
|
||||
return 0
|
||||
}
|
||||
|
||||
const maybeCount = await Utils.tryAndWait(
|
||||
(_, user) =>
|
||||
user
|
||||
.get(Key.WALL)
|
||||
|
|
@ -1286,7 +1288,10 @@ const createPost = async (tags, title, content) => {
|
|||
.get(Key.COUNT)
|
||||
.then(),
|
||||
v => typeof v !== 'number'
|
||||
))
|
||||
)
|
||||
|
||||
return typeof maybeCount === 'number' ? maybeCount : 0
|
||||
})()
|
||||
|
||||
const shouldBeNewPage =
|
||||
count >= Common.Constants.Misc.NUM_OF_POSTS_PER_WALL_PAGE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue