Adds files to git
This commit is contained in:
parent
ad3d27e927
commit
13d1de8251
|
@ -0,0 +1,9 @@
|
|||
// @flow
|
||||
import type { RecordOf } from 'immutable'
|
||||
|
||||
export type CookiesProps = {
|
||||
acceptedNecessary: boolean;
|
||||
acceptedAnalytics: boolean;
|
||||
}
|
||||
|
||||
export type Cookie = RecordOf<CookiesProps>
|
|
@ -0,0 +1,25 @@
|
|||
// @flow
|
||||
import { Map } from 'immutable'
|
||||
import { handleActions, type ActionType } from 'redux-actions'
|
||||
import type { Cookie } from '~/logic/cookies/store/model/cookie'
|
||||
import { SET_COOKIES_PERMISSIONS } from '../actions/setCookiesPermissions'
|
||||
import type { State } from '~/logic/tokens/store/reducer/tokens'
|
||||
|
||||
export const COOKIE_REDUCER_ID = 'cookies'
|
||||
|
||||
export type CookieReducerState = Map<string, Map<string, Cookie>>
|
||||
|
||||
export default handleActions<State, *>(
|
||||
{
|
||||
[SET_COOKIES_PERMISSIONS]: (state: State, action: ActionType<Function>): State => {
|
||||
const { acceptedNecessary, acceptedAnalytics } = action.payload
|
||||
|
||||
const newState = state.withMutations((mutableState) => {
|
||||
mutableState.set('acceptedNecessary', acceptedNecessary)
|
||||
mutableState.set('acceptedAnalytics', acceptedAnalytics)
|
||||
})
|
||||
return newState
|
||||
},
|
||||
},
|
||||
Map(),
|
||||
)
|
|
@ -0,0 +1,6 @@
|
|||
// @flow
|
||||
import { type GlobalState } from '~/store'
|
||||
import { COOKIE_REDUCER_ID } from '~/logic/cookies/store/reducer/cookies'
|
||||
|
||||
|
||||
export const cookiesSelector = (state: GlobalState) => state[COOKIE_REDUCER_ID]
|
Loading…
Reference in New Issue