X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/c9687b102bb6f544a034dc4d508bf0ae4a5fc221..76e3136f32e35ded2caf989b0bf699de64798921:/src/lib/stores.js diff --git a/src/lib/stores.js b/src/lib/stores.js index 910dd8c..e618db2 100644 --- a/src/lib/stores.js +++ b/src/lib/stores.js @@ -5,3 +5,16 @@ export const results_store = writable(); export const current_result_store = writable(); export const current_request_latlon = writable(); export const last_updated_store = writable(); +export const page = writable({count: 0}); + +export function refresh_page() { + let pagename = window.location.pathname.replace('.html', '').replace(/^.*\//, ''); + + if (['search', 'reverse', 'details', 'deletable', 'polygons'].indexOf(pagename) == -1) { + pagename = 'search'; + } + + // Add a counter here to make sure the store change is triggered + // everytime we refresh, not just when the page changes. + page.update(function(v) { return {tab: pagename, count: v.count + 1}}); +}