Skip to content

🎧 Your Personal Streaming Service

Use same key for replaygain's preAmp (#3184)

Kendall Garner290333ec5984
diff --git a/ui/src/reducers/replayGainReducer.js b/ui/src/reducers/replayGainReducer.js
index 6d51db2bf..41b087a85 100644
--- a/ui/src/reducers/replayGainReducer.js
+++ b/ui/src/reducers/replayGainReducer.js
@@ -1,7 +1,10 @@
import { CHANGE_GAIN, CHANGE_PREAMP } from '../actions'
+const GAIN_KEY = 'gainMode'
+const PREAMP_KEY = 'preAmp'
+
const getPreAmp = () => {
- const storage = localStorage.getItem('preamp')
+ const storage = localStorage.getItem(PREAMP_KEY)
if (storage === null) {
return 0
@@ -12,7 +15,7 @@ const getPreAmp = () => {
}
const initialState = {
- gainMode: localStorage.getItem('gainMode') || 'none',
+ gainMode: localStorage.getItem(GAIN_KEY) || 'none',
preAmp: getPreAmp(),
}
@@ -22,7 +25,7 @@ export const replayGainReducer = (
) => {
switch (type) {
case CHANGE_GAIN: {
- localStorage.setItem('gainMode', payload)
+ localStorage.setItem(GAIN_KEY, payload)
return {
...previousState,
gainMode: payload,
@@ -33,7 +36,7 @@ export const replayGainReducer = (
if (isNaN(value)) {
return previousState
}
- localStorage.setItem('preAmp', payload)
+ localStorage.setItem(PREAMP_KEY, payload)
return {
...previousState,
preAmp: value,