import { Actions } from "../actions" ; import { CacheState } from "./types" ; const initialState = { } ; export function cache ( state = initialState , action ) { switch ( action . type ) { case "REMOVE_WIDGET" : return { ... state , [ action . data . id ] : undefined , } ; case "RESET_STORE" : return initialState ; case "SET_BACKGROUND" : return action . data . from ? { ... state , [ action . data . from ] : undefined , } : state ; case "SET_CACHE" : return { ... state , [ action . payload . id ] : action . payload . cache , } ; default : return state ; } }