mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 05:48:11 +00:00
dzienniki
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<JournalOptions
|
||||
@on-search-confirm="fetchHistoryData"
|
||||
@on-options-reset="resetOptions"
|
||||
@on-refresh-data="fetchHistoryData"
|
||||
@on-refresh-data="fetchHistoryData(true)"
|
||||
:sorter-option-ids="['timestampFrom', 'duration']"
|
||||
:data-status="dataStatus"
|
||||
:current-options-active="currentOptionsActive"
|
||||
@@ -186,10 +186,10 @@ export default defineComponent({
|
||||
async addHistoryData() {
|
||||
this.scrollDataLoaded = false;
|
||||
|
||||
const countFrom = this.historyList.length;
|
||||
this.countFromIndex = this.historyList.length;
|
||||
|
||||
const responseData: DispatcherHistory[] = await (
|
||||
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}&countFrom=${countFrom}`)
|
||||
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}&countFrom=${this.countFromIndex}`)
|
||||
).data;
|
||||
|
||||
if (!responseData) return;
|
||||
@@ -203,7 +203,7 @@ export default defineComponent({
|
||||
this.scrollDataLoaded = true;
|
||||
},
|
||||
|
||||
async fetchHistoryData() {
|
||||
async fetchHistoryData(reset = false) {
|
||||
const queries: string[] = [];
|
||||
|
||||
const dispatcher = this.searchersValues['search-dispatcher'].trim();
|
||||
@@ -217,7 +217,7 @@ export default defineComponent({
|
||||
if (station) queries.push(`stationName=${station}`);
|
||||
if (timestampFrom && timestampTo) queries.push(`timestampFrom=${timestampFrom}`, `timestampTo=${timestampTo}`);
|
||||
|
||||
// Z API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
|
||||
// API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
|
||||
if (this.sorterActive.id == 'timestampFrom') queries.push('sortBy=timestampFrom');
|
||||
else if (this.sorterActive.id == 'duration') queries.push('sortBy=currentDuration');
|
||||
else queries.push('sortBy=timestampFrom');
|
||||
@@ -230,6 +230,8 @@ export default defineComponent({
|
||||
this.currentQueryArray = queries;
|
||||
|
||||
try {
|
||||
if (reset) this.dataStatus = DataStatus.Loading;
|
||||
|
||||
const responseData: DispatcherHistory[] = await (
|
||||
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`)
|
||||
).data;
|
||||
|
||||
Reference in New Issue
Block a user