diff --git a/src/components/search/thumbnail-config.json b/src/components/search/thumbnail-config.json index 8514da47..f9c3c3d7 100644 --- a/src/components/search/thumbnail-config.json +++ b/src/components/search/thumbnail-config.json @@ -1,4 +1,4 @@ { "eodms_use_image": true, - "thumbnail_correction_proxy_dev": "https://geocore.api.geo.ca/image-processor?url=" + "thumbnail_correction_proxy_dev": "https://tiler.api.geo.ca/image-processor?url=" } diff --git a/src/reducers/localStorage.ts b/src/reducers/localStorage.ts index 647a6392..a4b29acb 100644 --- a/src/reducers/localStorage.ts +++ b/src/reducers/localStorage.ts @@ -15,33 +15,51 @@ function checkNestedProperty(obj, props: string): boolean { export const loadState = (): StoreEnhancer | undefined => { try { - const serializedState = localStorage.getItem('state'); - if (serializedState === null) { - return undefined; + const urlParams = new URLSearchParams(window.location.search); + if (!urlParams.toString()) { + const serializedState = localStorage.getItem('state'); + if (serializedState === null) { + return undefined; + } + const state = JSON.parse(serializedState); + if (!checkNestedProperty(state, 'mappingReducer.spatempfilter')) { + state['mappingReducer'].spatempfilter = INITSPATIALTEMPORALFILTER; + } + if (!checkNestedProperty(state, 'mappingReducer.spatialfilter')) { + state['mappingReducer'].spatialfilter = []; + } + if (!checkNestedProperty(state, 'mappingReducer.metasrcfilter')) { + state['mappingReducer'].metasrcfilter = INITMETADATASRCFILTER; + } + if (!checkNestedProperty(state, 'mappingReducer.stacfilter')) { + state['mappingReducer'].stacfilter = []; + } + if (!checkNestedProperty(state, 'mappingReducer.center')) { + state['mappingReducer'].center = INITMAINMAPINFO.center; + } + if (!checkNestedProperty(state, 'mappingReducer.zoom')) { + state['mappingReducer'].zoom = INITMAINMAPINFO.zoom; + } + if (!checkNestedProperty(state, 'mappingReducer.freezeMapSearch')) { + state['mappingReducer'].freezeMapSearch = { freeze: true }; + } + return state; } - const state = JSON.parse(serializedState); - if (!checkNestedProperty(state, 'mappingReducer.spatempfilter')) { - state['mappingReducer'].spatempfilter = INITSPATIALTEMPORALFILTER; - } - if (!checkNestedProperty(state, 'mappingReducer.spatialfilter')) { + else { + const serializedState = localStorage.getItem('state'); + if (serializedState === null) { + return undefined; + } + const state = JSON.parse(serializedState); + state['mappingReducer'].spatempfilter = { extents: [], startDate: "", endDate: "" }; state['mappingReducer'].spatialfilter = []; - } - if (!checkNestedProperty(state, 'mappingReducer.metasrcfilter')) { - state['mappingReducer'].metasrcfilter = INITMETADATASRCFILTER; - } - if (!checkNestedProperty(state, 'mappingReducer.stacfilter')) { + state['mappingReducer'].metasrcfilter = { sources: [], dataCollection: '', polarization: '', orbitDirection: '' }; state['mappingReducer'].stacfilter = []; - } - if (!checkNestedProperty(state, 'mappingReducer.center')) { - state['mappingReducer'].center = INITMAINMAPINFO.center; - } - if (!checkNestedProperty(state, 'mappingReducer.zoom')) { - state['mappingReducer'].zoom = INITMAINMAPINFO.zoom; - } - if (!checkNestedProperty(state, 'mappingReducer.freezeMapSearch')) { + state['mappingReducer'].center = { lat: 54.5, lng: -115 }; + state['mappingReducer'].zoom = []; state['mappingReducer'].freezeMapSearch = { freeze: true }; + return state; } - return state; } catch (err) { return undefined; }