Files
freeCodeCamp/client/src/redux/sound-mode-saga.js
Nicholas Carrigan (he/him) 07bfe87419 feat: add campfire mode (#42663)
* feat: add campfire mode

fix: resolve lint issues

feat: add sound to editor

fix: restore flash messages

fix: linter issues

fix: obey sound setting

Update the editor to obey the camper's sound setting.

chore: apply suggestions from code review

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

fix: use @types/store

fix: linter issues

feat: simplify sound saga

Update client/src/redux/sound-mode-saga.js

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

fix: missing bracket

chore: use new s3 bucket

fix: lint

fix: import only needed bits

fix: remove from navbar

(was intermittently broken here anyway)

fix: dynamic imports?

fix: more dynamic imports

fix: tweak theme logic

chore: boolean | undefined

fix: dns

fix: no hammer local storage

* chore: apply oliver's review suggestions

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* fix: lost an import

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-10-27 17:50:29 -05:00

27 lines
612 B
JavaScript

/* eslint-disable require-yield */
import { takeEvery } from 'redux-saga/effects';
import store from 'store';
const soundKey = 'fcc-sound';
export function setSound(setting) {
store.set(soundKey, setting);
}
function* updateLocalSoundSaga({ payload: { user, sound } }) {
if (user) {
const { sound = false } = user;
setSound(sound);
} else if (typeof sound !== 'undefined') {
setSound(sound);
}
}
export function createSoundModeSaga(types) {
return [
takeEvery(types.fetchUserComplete, updateLocalSoundSaga),
takeEvery(types.updateUserFlagComplete, updateLocalSoundSaga)
];
}