Skip to content

Commit

Permalink
fix(posts): handle start param
Browse files Browse the repository at this point in the history
used legacy code method of checking if start is a parameter, to
conditionally set start and page for posts api call
  • Loading branch information
unenglishable committed Jul 21, 2021
1 parent 2ba84e4 commit f672852
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/views/Posts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ export default {
beforeRouteEnter(to, from, next) {
const params = {
limit: localStoragePrefs().data.posts_per_page,
page: to.query.page || 1,
start: to.query.start
page: isNaN(to.query.start) ? to.query.page || 1 : undefined,
start: isNaN(to.query.start) ? undefined : Number(to.query.start)
}
threadsApi.slugToThreadId(to.params.threadSlug).then(t => t.id)
.then(threadId => {
Expand All @@ -465,8 +465,8 @@ export default {
beforeRouteUpdate(to, from, next) {
const params = {
limit: localStoragePrefs().data.posts_per_page,
page: to.query.page || 1,
start: to.query.start
page: isNaN(to.query.start) ? to.query.page || 1 : undefined,
start: isNaN(to.query.start) ? undefined : Number(to.query.start)
}
threadsApi.slugToThreadId(to.params.threadSlug).then(t => t.id)
.then(threadId => {
Expand All @@ -492,8 +492,8 @@ export default {
const params = {
thread_id: threadId,
limit: v.prefs.posts_per_page,
page: $route.query.page || 1,
start: $route.query.start
page: isNaN($route.query.start) ? $route.query.page || 1 : undefined,
start: isNaN($route.query.start) ? undefined : Number($route.query.start)
}
return postsApi.byThread(params)
})
Expand Down

0 comments on commit f672852

Please sign in to comment.