Use proper API calling method

This commit is contained in:
D. Berge
2020-08-11 17:15:23 +02:00
parent d55197937c
commit 5341db7026

View File

@@ -170,20 +170,11 @@ export default {
methods: {
async fitProjectBounds () {
try {
this.loading = true;
const res = await fetch(`${this.$root.apiUrl}/project/${this.$route.params.project}/gis`);
if (res.ok) {
const bbox = new L.GeoJSON(await res.json());
map.fitBounds(bbox.getBounds());
} else {
this.$root.showSnack(res.statusText, "warning");
}
} catch (err) {
this.$root.showSnack(err, "error")
} finally {
this.loading = false;
}
this.loading = true;
const res = await this.api([`/project/${this.$route.params.project}/gis`]);
const bbox = new L.GeoJSON(res);
map.fitBounds(bbox.getBounds());
this.loading = false;
},
async refreshLayers (layerset) {