improve pagination
This commit is contained in:
@ -403,6 +403,7 @@ func (app *application) VirtualTerminalPaymentSucceeded(w http.ResponseWriter, r
|
||||
_, err = app.SaveTransaction(txn)
|
||||
if err != nil {
|
||||
app.badRequest(w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
app.writeJSON(w, http.StatusOK, txn)
|
||||
@ -602,6 +603,7 @@ func (app *application) GetSale(w http.ResponseWriter, r *http.Request) {
|
||||
order, err := app.DB.GetOrderByID(orderID)
|
||||
if err != nil {
|
||||
app.badRequest(w, r, err)
|
||||
return
|
||||
}
|
||||
app.writeJSON(w, http.StatusOK, order)
|
||||
}
|
||||
|
@ -25,7 +25,14 @@ All Sales
|
||||
{{ end }}
|
||||
{{ define "js" }}
|
||||
<script type="module">
|
||||
import {showTable, pageSize, currentPage} from "/static/js/all-sales.js"
|
||||
showTable({{.API}}, pageSize, currentPage);
|
||||
import {pageSize} from "/static/js/common.js"
|
||||
import {showTable, currentPage} from "/static/js/all-sales.js"
|
||||
|
||||
let curPage = currentPage;
|
||||
if (localStorage.getItem("cur-page") !== null) {
|
||||
curPage = localStorage.getItem("cur-page");
|
||||
localStorage.removeItem("cur-page");
|
||||
}
|
||||
showTable({{.API}}, pageSize, curPage);
|
||||
</script>
|
||||
{{ end }}
|
||||
|
@ -28,7 +28,14 @@ All Subscriptions
|
||||
|
||||
{{define "js"}}
|
||||
<script type="module">
|
||||
import {showTable, pageSize, currentPage} from "/static/js/all-subscriptions.js"
|
||||
showTable({{.API}}, pageSize, currentPage);
|
||||
import {pageSize} from "/static/js/common.js"
|
||||
import {showTable, currentPage} from "/static/js/all-subscriptions.js"
|
||||
|
||||
let curPage = currentPage;
|
||||
if (localStorage.getItem("cur-page") !== null) {
|
||||
curPage = localStorage.getItem("cur-page");
|
||||
localStorage.removeItem("cur-page");
|
||||
}
|
||||
showTable({{.API}}, pageSize, curPage);
|
||||
</script>
|
||||
{{end}}
|
||||
|
Reference in New Issue
Block a user