mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-17 12:07:09 +00:00
Adds files to git
This commit is contained in:
parent
ad3d27e927
commit
13d1de8251
9
src/logic/cookies/store/model/cookie.js
Normal file
9
src/logic/cookies/store/model/cookie.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// @flow
|
||||||
|
import type { RecordOf } from 'immutable'
|
||||||
|
|
||||||
|
export type CookiesProps = {
|
||||||
|
acceptedNecessary: boolean;
|
||||||
|
acceptedAnalytics: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Cookie = RecordOf<CookiesProps>
|
25
src/logic/cookies/store/reducer/cookies.js
Normal file
25
src/logic/cookies/store/reducer/cookies.js
Normal file
@ -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(),
|
||||||
|
)
|
6
src/logic/cookies/store/selectors/index.js
Normal file
6
src/logic/cookies/store/selectors/index.js
Normal file
@ -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…
x
Reference in New Issue
Block a user