Base dark theme implementation
This commit is contained in:
@@ -98,3 +98,7 @@ export const validatePasswordResetFailure = (error) => ({
|
||||
type: UserActionTypes.VALIDATE_PASSWORD_RESET_FAILURE,
|
||||
payload: error,
|
||||
});
|
||||
export const setTheme = (theme) => ({
|
||||
type: UserActionTypes.SET_THEME,
|
||||
payload: theme,
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ const INITIAL_STATE = {
|
||||
bodyshop: null,
|
||||
signingIn: false,
|
||||
error: null,
|
||||
theme: "system"
|
||||
};
|
||||
|
||||
const userReducer = (state = INITIAL_STATE, action) => {
|
||||
@@ -48,6 +49,8 @@ const userReducer = (state = INITIAL_STATE, action) => {
|
||||
|
||||
case UserActionTypes.SET_SHOP_DETAILS:
|
||||
return { ...state, bodyshop: action.payload };
|
||||
case UserActionTypes.SET_THEME:
|
||||
return { ...state, theme: action.payload };
|
||||
case UserActionTypes.SIGN_IN_FAILURE:
|
||||
case UserActionTypes.SIGN_OUT_FAILURE:
|
||||
case UserActionTypes.EMAIL_SIGN_UP_FAILURE:
|
||||
|
||||
@@ -31,3 +31,8 @@ export const selectSigningIn = createSelector(
|
||||
[selectUser],
|
||||
(user) => user.signingIn
|
||||
);
|
||||
|
||||
export const selectTheme = createSelector(
|
||||
[selectUser],
|
||||
(user) => user.theme
|
||||
);
|
||||
@@ -26,5 +26,6 @@ const UserActionTypes = {
|
||||
VALIDATE_PASSWORD_RESET_START: "VALIDATE_PASSWORD_RESET_START",
|
||||
VALIDATE_PASSWORD_RESET_SUCCESS: "VALIDATE_PASSWORD_RESET_SUCCESS",
|
||||
VALIDATE_PASSWORD_RESET_FAILURE: "VALIDATE_PASSWORD_RESET_FAILURE",
|
||||
SET_THEME: "SET_THEME",
|
||||
};
|
||||
export default UserActionTypes;
|
||||
|
||||
Reference in New Issue
Block a user