Skip to content

Commit

Permalink
FIX #75 to return right pageTokwn
Browse files Browse the repository at this point in the history
  • Loading branch information
hywook4 committed Aug 16, 2021
1 parent c3621da commit 76bb189
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/api/v1/follow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ router.get('/', async (request: express.Request, response: express.Response) =>
}

const follows = result.map(data => data.dataValues[target]);

response.json({
follows: follows,
pageToken: follows.length > 0 ? follows[follows.length - 1].id : null
pageToken: follows.length > 0 ? result[result.length-1].dataValues.id : parseInt(request.query.pageToken as string)
});

return;
Expand Down
4 changes: 2 additions & 2 deletions src/api/v1/logoffedPostList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ router.get('/recent-videos', async (request: express.Request, response: express.

response.json({
videoList: recentVideoList,
pageToken: recentVideoList.length > 0 ? recentVideoList[recentVideoList.length - 1].id : null
pageToken: recentVideoList.length > 0 ? recentVideoList[recentVideoList.length - 1].id : parseInt(request.query.pageToken as string)
});
return;
});
Expand Down Expand Up @@ -97,4 +97,4 @@ router.get('/hot-videos', async (request: express.Request, response: express.Res



export default router;
export default router;
4 changes: 2 additions & 2 deletions src/api/v1/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ router.get('/user-videos/:userId', async (request: express.Request, response: ex

response.json({
videoList: userVideos,
pageToken: userVideos.length > 0 ? userVideos[userVideos.length - 1].id : null
pageToken: userVideos.length > 0 ? userVideos[userVideos.length - 1].id : parseInt(request.query.pageToken as string)
});
return;
});
Expand Down Expand Up @@ -243,4 +243,4 @@ router.delete('/video', middleware.validateToken, async (request: express.Reques
});


export default router;
export default router;
2 changes: 1 addition & 1 deletion src/service/googleService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ class GoogleService {

const googleService = new GoogleService();

export default googleService;
export default googleService;

0 comments on commit 76bb189

Please sign in to comment.