Dodano dynamiczne odświeżanie tabeli

This commit is contained in:
2020-07-04 22:32:15 +02:00
parent 28fab8be92
commit ee2b5ddc07
3 changed files with 15 additions and 11 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
{ {
"hosting": { "hosting": {
"public": "public", "public": "dist",
"site": "stacjownik-td2",
"ignore": [ "ignore": [
"firebase.json", "firebase.json",
"**/.*", "**/.*",
+12 -7
View File
@@ -41,7 +41,15 @@ export default Vue.extend({
}), }),
methods: { methods: {
...mapActions(["fetchStations"]) ...mapActions(["fetchStations"]),
getStationList() {
this.fetchStations()
.then(() => (this.connectionState = 2))
.catch(err => {
this.connectionState = 1;
this.errorMessage = err.message;
});
}
}, },
data: () => ({ data: () => ({
errorMessage: "", errorMessage: "",
@@ -49,12 +57,9 @@ export default Vue.extend({
}), }),
mounted() { mounted() {
this.fetchStations() this.getStationList();
.then(() => (this.connectionState = 2))
.catch(err => { setInterval(this.getStationList, 5000);
this.connectionState = 1;
this.errorMessage = err.message;
});
} }
}); });
</script> </script>
-2
View File
@@ -122,8 +122,6 @@ export default Vue.extend({
); );
}, },
focusedStationInfo() { focusedStationInfo() {
console.log(this.focusedStationName);
return this.stations.find( return this.stations.find(
(station: any) => station.stationName === this.focusedStationName (station: any) => station.stationName === this.focusedStationName
); );