Skip to content

Commit

Permalink
Merge pull request #40 from rkshaon/rkshaon
Browse files Browse the repository at this point in the history
updt: frontend - page number twice api called
  • Loading branch information
rkshaon authored Sep 13, 2024
2 parents 6039c61 + 83fc1e2 commit be41e91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 6 additions & 2 deletions frontend/src/pages/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ export default {
}
},
mounted () {
this.fetchBooks()
// this.fetchBooks()
const currentPage = this.$route.query.page || 1
if (!this.$route.query.page) {
this.fetchBooks({ page: currentPage, pageSize: this.pageSize })
}
},
methods: {
...mapActions(['fetchBooks']),
changePage (page) {
this.$router.push({ query: { page } })
this.fetchBooks({ page, pageSize: this.pageSize })
// this.fetchBooks({ page, pageSize: this.pageSize })
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/services/v1/bookAPIService.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ const API_BASE_URL = process.env.VUE_APP_BACKEND_URL

export default {
async fetchV1Books (page = 1, pageSize = 8) {
// console.log(page, pageSize);

page = page ?? 1
pageSize = pageSize ?? 8
console.log(page, pageSize)
Expand Down

0 comments on commit be41e91

Please sign in to comment.