X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/71b9066d9eed97aee7eff27a25d5c317b6f89595..e678691b909996b245bdd17e7345467634703d6b:/src/lib/stores.js diff --git a/src/lib/stores.js b/src/lib/stores.js index 6220ecc..00b4195 100644 --- a/src/lib/stores.js +++ b/src/lib/stores.js @@ -3,6 +3,7 @@ import { writable } from 'svelte/store'; export const map_store = writable(); export const results_store = writable(); export const last_api_request_url_store = writable(); +export const error_store = writable(); export const page = writable(); /** @@ -33,8 +34,16 @@ export function refresh_page(pagename, params) { if (param_str) { param_str = '?' + param_str; } - window.history.pushState([], '', pagename + '.html' + param_str); + let new_url = pagename + '.html' + param_str; + + if (window.location.protocol.match(/^http/)) { + window.history.pushState([], '', new_url); + } else { + window.location.href = new_url; + } } page.set({ tab: pagename, params: params }); + last_api_request_url_store.set(null); + error_store.set(null); }