mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Dodano dynamiczne odświeżanie tabeli
This commit is contained in:
+12
-7
@@ -41,7 +41,15 @@ export default Vue.extend({
|
||||
}),
|
||||
|
||||
methods: {
|
||||
...mapActions(["fetchStations"])
|
||||
...mapActions(["fetchStations"]),
|
||||
getStationList() {
|
||||
this.fetchStations()
|
||||
.then(() => (this.connectionState = 2))
|
||||
.catch(err => {
|
||||
this.connectionState = 1;
|
||||
this.errorMessage = err.message;
|
||||
});
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
errorMessage: "",
|
||||
@@ -49,12 +57,9 @@ export default Vue.extend({
|
||||
}),
|
||||
|
||||
mounted() {
|
||||
this.fetchStations()
|
||||
.then(() => (this.connectionState = 2))
|
||||
.catch(err => {
|
||||
this.connectionState = 1;
|
||||
this.errorMessage = err.message;
|
||||
});
|
||||
this.getStationList();
|
||||
|
||||
setInterval(this.getStationList, 5000);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -122,8 +122,6 @@ export default Vue.extend({
|
||||
);
|
||||
},
|
||||
focusedStationInfo() {
|
||||
console.log(this.focusedStationName);
|
||||
|
||||
return this.stations.find(
|
||||
(station: any) => station.stationName === this.focusedStationName
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user