File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -275,15 +275,21 @@ export default {
275275 }
276276
277277 const downloadShapefile = async function () {
278- const url = ' https://mapserver.mosquitoalert.com/geoserver/mosquitoalert/wfs ?service=WFS&version=1.0.0&request=GetFeature&typeName=mosquitoalert:discoveries&outputFormat=SHAPE-ZIP'
278+ const url = ' https://mapserver.mosquitoalert.com/geoserver/mosquitoalert/ows ?service=WFS&version=1.0.0&request=GetFeature&typeName=mosquitoalert:discoveries&outputFormat=SHAPE-ZIP'
279279 loadingDownload .value = true
280- fetch (url)
281- .then (response => {
282- exportFile (' discoveries.shp' , response)
283- })
284- .finally (() => {
285- loadingDownload .value = false
286- })
280+
281+ try {
282+ const response = await fetch (url)
283+ if (! response .ok ) {
284+ throw new Error (` HTTP error! status: ${ response .status } ` )
285+ }
286+ const blob = await response .blob ()
287+ exportFile (' discoveries.zip' , blob)
288+ } catch (err) {
289+ console .error (' Failed to download shapefile:' , err)
290+ } finally {
291+ loadingDownload .value = false
292+ }
287293 }
288294
289295 return {
You can’t perform that action at this time.
0 commit comments