check return type from gun
This commit is contained in:
parent
d0349669f9
commit
35e2197095
1 changed files with 22 additions and 1 deletions
|
|
@ -56,7 +56,28 @@ const getWallPage = async page => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.load(res)
|
.load(res)
|
||||||
}),
|
}),
|
||||||
v => typeof v !== 'object'
|
maybePage => {
|
||||||
|
if (typeof maybePage !== 'object' || maybePage === null) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
const clean = {
|
||||||
|
...maybePage
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
for (const [key, post] of Object.entries(clean.posts)) {
|
||||||
|
// delete unsuccessful writes
|
||||||
|
if (post === null) {
|
||||||
|
// @ts-ignore
|
||||||
|
delete clean.posts[key]
|
||||||
|
} else {
|
||||||
|
post.id = key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return !Common.Schema.isWallPage(clean)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const clean = {
|
const clean = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue