forked from MapComplete/MapComplete
Studio: more fixes
This commit is contained in:
parent
3ceebaba12
commit
80b7a038cf
7 changed files with 129 additions and 77 deletions
|
|
@ -22,9 +22,7 @@ export default class StudioServer {
|
|||
|
||||
async fetchLayer(layerId: string): Promise<LayerConfigJson> {
|
||||
try {
|
||||
return await Utils.downloadJson(
|
||||
this.url + "/layers/" + layerId + "/" + layerId + ".json"
|
||||
)
|
||||
return await Utils.downloadJson(this.layerUrl(layerId))
|
||||
} catch (e) {
|
||||
return undefined
|
||||
}
|
||||
|
|
@ -35,7 +33,7 @@ export default class StudioServer {
|
|||
if (id === undefined || id === "") {
|
||||
return
|
||||
}
|
||||
await fetch(`${this.url}/layers/${id}/${id}.json`, {
|
||||
await fetch(this.layerUrl(id), {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json;charset=utf-8",
|
||||
|
|
@ -43,4 +41,8 @@ export default class StudioServer {
|
|||
body: JSON.stringify(config, null, " "),
|
||||
})
|
||||
}
|
||||
|
||||
public layerUrl(id: string) {
|
||||
return `${this.url}/layers/${id}/${id}.json`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue