feature: skrót posterunku

This commit is contained in:
2023-04-04 21:30:16 +02:00
parent ea48085f6f
commit 4847524b64
5 changed files with 27 additions and 15 deletions
+10
View File
@@ -32,6 +32,7 @@ export const useStore = defineStore('store', {
changesResponse: [],
} as IStore),
actions: {
fetchSceneriesData() {
this.dataState = 'LOADING';
@@ -95,4 +96,13 @@ export const useStore = defineStore('store', {
return axios.post<{ user: IUser }>('auth/token', { token: this.token }, { baseURL });
},
},
getters: {
sortedStationList(state) {
return state.stationList
.filter((station) => station.name.toLowerCase().startsWith(state.searchedSceneryName.toLowerCase()))
.sort((a, b) => (a.name > b.name ? 1 : -1))
.filter((_, i) => i < state.maxVisibleResults);
},
},
});