mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: show user URL in remote data loading error
Instead of the proxied one, which is less readable and actionable for the user reading the alert message.
This commit is contained in:
parent
a442e56cbc
commit
1f66377104
1 changed files with 3 additions and 3 deletions
|
@ -305,14 +305,14 @@ export class DataLayer extends ServerStored {
|
||||||
return this.isRemoteLayer() && Boolean(this.options.remoteData?.dynamic)
|
return this.isRemoteLayer() && Boolean(this.options.remoteData?.dynamic)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUrl(url) {
|
async getUrl(url, initialUrl) {
|
||||||
const response = await this._umap.request.get(url)
|
const response = await this._umap.request.get(url)
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (response?.ok) return resolve(response.text())
|
if (response?.ok) return resolve(response.text())
|
||||||
Alert.error(
|
Alert.error(
|
||||||
translate('Cannot load remote data for layer "{layer}" with url "{url}"', {
|
translate('Cannot load remote data for layer "{layer}" with url "{url}"', {
|
||||||
layer: this.getName(),
|
layer: this.getName(),
|
||||||
url: url,
|
url: initialUrl || url,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -328,7 +328,7 @@ export class DataLayer extends ServerStored {
|
||||||
if (this.options.remoteData.proxy) {
|
if (this.options.remoteData.proxy) {
|
||||||
url = this._umap.proxyUrl(url, this.options.remoteData.ttl)
|
url = this._umap.proxyUrl(url, this.options.remoteData.ttl)
|
||||||
}
|
}
|
||||||
return await this.getUrl(url).then((raw) => {
|
return await this.getUrl(url, remoteUrl).then((raw) => {
|
||||||
this.clear()
|
this.clear()
|
||||||
return this._umap.formatter
|
return this._umap.formatter
|
||||||
.parse(raw, this.options.remoteData.format)
|
.parse(raw, this.options.remoteData.format)
|
||||||
|
|
Loading…
Reference in a new issue