mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:47:08 +00:00
Use proper API calling method
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user