-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 課程列表 page 功能 #15
Conversation
const page = req.query.page || 1 | ||
const limit = 20 | ||
const offset = (page - 1) * limit | ||
|
||
const courseData = await Course.findAndCountAll({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limit 會是由前端送給後端
這樣當前端要改成單頁 10 筆時,後端也不用跟著動了
這部分可能再修正一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
}) | ||
|
||
const courses = courseData.map((course) => { | ||
console.log(courseData.rows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log 記得要移除唷!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已移除
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改回覆
const page = req.query.page || 1 | ||
const limit = 20 | ||
const offset = (page - 1) * limit | ||
|
||
const courseData = await Course.findAndCountAll({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
}) | ||
|
||
const courses = courseData.map((course) => { | ||
console.log(courseData.rows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已移除
@ankazu 感謝 John,再麻煩合併至 dev branch 🙏 |
page 設定,上限 20 筆資料