You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			35 lines
		
	
	
		
			595 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			35 lines
		
	
	
		
			595 B
		
	
	
	
		
			TypeScript
		
	
export const APPLY_THEME = 'APPLY_THEME';
 | 
						|
export type ThemeStateType = typeof lightTheme;
 | 
						|
 | 
						|
export const applyTheme = (theme: ThemeStateType) => {
 | 
						|
  return {
 | 
						|
    type: APPLY_THEME,
 | 
						|
    payload: theme,
 | 
						|
  };
 | 
						|
};
 | 
						|
import { lightTheme } from './SessionTheme';
 | 
						|
 | 
						|
const initialState = lightTheme;
 | 
						|
 | 
						|
export const reducer = (
 | 
						|
  state: any = initialState,
 | 
						|
  {
 | 
						|
    type,
 | 
						|
    payload,
 | 
						|
  }: {
 | 
						|
    type: string;
 | 
						|
    payload: ThemeStateType;
 | 
						|
  }
 | 
						|
): ThemeStateType => {
 | 
						|
  switch (type) {
 | 
						|
    case APPLY_THEME:
 | 
						|
      return payload;
 | 
						|
    default:
 | 
						|
      return state;
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
export const actions = {
 | 
						|
  applyTheme,
 | 
						|
};
 |