1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-07-15 01:25:10 +02:00

Feature: Add pagination & limits to URL parameters ()

* Set search conditions to query parameters

* Fixed by review

* Update query parameters when new message notified
This commit is contained in:
Yuuki Takahashi
2024-06-01 20:32:11 +09:00
committed by Ralph Slooten
parent 31390e4b82
commit e87b98b73b
11 changed files with 106 additions and 21 deletions

@ -33,17 +33,25 @@ export default {
watch: {
$route(to, from) {
this.doSearch(true)
this.doSearch()
}
},
mounted() {
const paginationParams = this.getPaginationParams()
if (paginationParams?.start) {
pagination.start = paginationParams.start
}
if (paginationParams?.limit) {
pagination.limit = paginationParams.limit
}
mailbox.searching = this.getSearch()
this.doSearch(false)
this.doSearch()
},
methods: {
doSearch: function (resetPagination) {
doSearch: function () {
let s = this.getSearch()
if (!s) {
@ -54,10 +62,6 @@ export default {
mailbox.searching = s
if (resetPagination) {
pagination.start = 0
}
this.apiURI = this.resolve(`/api/v1/search`) + '?query=' + encodeURIComponent(s)
if (mailbox.timeZone != '' && (s.indexOf('after:') != -1 || s.indexOf('before:') != -1)) {
this.apiURI += '&tz=' + encodeURIComponent(mailbox.timeZone)