initialize to 0 and optimize for it
This commit is contained in:
parent
611a5fb093
commit
64c16d88e7
2 changed files with 8 additions and 1 deletions
|
|
@ -1513,7 +1513,7 @@ const initWall = async () => {
|
|||
user
|
||||
.get(Key.WALL)
|
||||
.get(Key.NUM_OF_PAGES)
|
||||
.put(1, ack => {
|
||||
.put(0, ack => {
|
||||
if (ack.err) {
|
||||
rej(new Error(ack.err))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,13 @@ const getWallPage = async (page, publicKey) => {
|
|||
)
|
||||
}
|
||||
|
||||
if (totalPages === 0) {
|
||||
return {
|
||||
count: 0,
|
||||
posts: {}
|
||||
}
|
||||
}
|
||||
|
||||
const actualPageIdx = page < 0 ? totalPages + page : page - 1
|
||||
|
||||
if (actualPageIdx > totalPages - 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue