Mercurial > gemma
diff client/src/store/fairwayavailability.js @ 3486:1fbb6dc7d362
fairwayavailability: refactor constants
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 27 May 2019 16:33:30 +0200 |
parents | 4eefeeae03fc |
children | 624c64670d48 |
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js Mon May 27 16:28:22 2019 +0200 +++ b/client/src/store/fairwayavailability.js Mon May 27 16:33:30 2019 +0200 @@ -32,9 +32,9 @@ }; const TYPES = { - BOTTLENECKS: "bottlenecks", - SECTIONS: "sections", - STRETCHES: "stretches" + BOTTLENECK: "bottleneck", + SECTION: "section", + STRETCH: "stretch" }; const FREQUENCIES = { @@ -67,7 +67,7 @@ const init = () => { return { - type: "bottlenecks", + type: TYPES.BOTTLENECK, selectedFairwayAvailabilityFeature: null, to: format(new Date(), "YYYY-MM-DD"), from: format(subYears(new Date(), 1), "YYYY-MM-DD"), @@ -222,18 +222,18 @@ let additionalParams = ""; let endpoint = ""; switch (type) { - case TYPES.BOTTLENECKS: + case TYPES.BOTTLENECK: endpoint = "bottleneck"; if (limitingFactor === LIMITINGFACTORS.DEPTH) additionalParams = `&breaks=${depthLimit1},${depthLimit2}`; if (limitingFactor === LIMITINGFACTORS.WIDTH) additionalParams = `&breaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.SECTIONS: + case TYPES.SECTION: endpoint = "section"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.STRETCHES: + case TYPES.STRETCH: endpoint = "stretch"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break; @@ -285,18 +285,18 @@ let additionalParams = ""; let endpoint = ""; switch (type) { - case TYPES.BOTTLENECKS: + case TYPES.BOTTLENECK: endpoint = "bottleneck"; if (limitingFactor === LIMITINGFACTORS.DEPTH) additionalParams = `&breaks=${depthLimit1},${depthLimit2}`; if (limitingFactor === LIMITINGFACTORS.WIDTH) additionalParams = `&breaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.SECTIONS: + case TYPES.SECTION: endpoint = "section"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.STRETCHES: + case TYPES.STRETCH: endpoint = "stretch"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break;