chore: remove night-mode-saga (#43829)

The saga only sets the value of fcc-theme in storage, but the values are
never retrieved, so the saga can be removed.
This commit is contained in:
Oliver Eyton-Williams
2021-10-13 11:00:00 +02:00
committed by GitHub
parent 93ad0ae036
commit e209582daf
2 changed files with 1 additions and 35 deletions

View File

@ -13,7 +13,6 @@ import { createFetchUserSaga } from './fetch-user-saga';
import { createGaSaga } from './ga-saga';
import hardGoToEpic from './hard-go-to-epic';
import { createNightModeSaga } from './night-mode-saga';
import { createReportUserSaga } from './report-user-saga';
import { actionTypes as settingsTypes } from './settings/action-types';
@ -75,8 +74,7 @@ export const sagas = [
...createGaSaga(actionTypes),
...createFetchUserSaga(actionTypes),
...createShowCertSaga(actionTypes),
...createReportUserSaga(actionTypes),
...createNightModeSaga({ ...actionTypes, ...settingsTypes })
...createReportUserSaga(actionTypes)
];
export const appMount = createAction(actionTypes.appMount);

View File

@ -1,32 +0,0 @@
/* eslint-disable require-yield */
import { takeEvery } from 'redux-saga/effects';
import store from 'store';
const themeKey = 'fcc-theme';
const defaultTheme = 'default';
export function setTheme(currentTheme = defaultTheme, theme) {
if (currentTheme !== theme) {
store.set(themeKey, theme);
}
}
function* updateLocalThemeSaga({ payload: { user, theme } }) {
const currentTheme = store.get(themeKey) || defaultTheme;
if (user) {
const { theme = defaultTheme } = user;
return setTheme(currentTheme, theme);
}
if (theme) {
return setTheme(currentTheme, theme);
}
return setTheme(currentTheme);
}
export function createNightModeSaga(types) {
return [
takeEvery(types.fetchUserComplete, updateLocalThemeSaga),
takeEvery(types.updateUserFlagComplete, updateLocalThemeSaga)
];
}