Skip to content

Commit

Permalink
fix(config): Fix config load
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorgerhardt committed Apr 30, 2018
1 parent c7176c8 commit 7cf2686
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/actions/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ export const setNetworksToEmpty = () =>
export function initialize (startCoordinate?: LonLat) {
try {
const json = retrieveConfig()
if (!json || !json.networks) {
console.error('Invalid JSON config! A networks array is required.')
} else {
return loadDataset(
json.networks,
json.grids,
json.pointsOfInterestUrl,
startCoordinate || json.startCoordinate
)
if (json) {
if (!json.networks) {
window.alert('JSON config found in localStorage without a networks array.')
} else {
return loadDataset(
json.networks,
json.grids,
json.pointsOfInterestUrl,
startCoordinate || json.startCoordinate
)
}
}
} catch (e) {
console.log('Error parsing taui-config', e)
Expand All @@ -70,7 +72,7 @@ export function initialize (startCoordinate?: LonLat) {
next: response => {
const c = response.value
storeConfig(c)
return loadDatasetFromJSON(
return loadDataset(
c.networks,
c.grids,
c.pointsOfInterestUrl,
Expand Down

0 comments on commit 7cf2686

Please sign in to comment.