]> cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/reducers/identity_proofs.js
squashed identity proof updates (#10375)
[mastodon.git] / app / javascript / mastodon / reducers / identity_proofs.js
1 import { Map as ImmutableMap, fromJS } from 'immutable';
2 import {
3 IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST,
4 IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS,
5 IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL,
6 } from '../actions/identity_proofs';
7
8 const initialState = ImmutableMap();
9
10 export default function identityProofsReducer(state = initialState, action) {
11 switch(action.type) {
12 case IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST:
13 return state.set('isLoading', true);
14 case IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL:
15 return state.set('isLoading', false);
16 case IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS:
17 return state.update(identity_proofs => identity_proofs.withMutations(map => {
18 map.set('isLoading', false);
19 map.set('loaded', true);
20 map.set(action.accountId, fromJS(action.identity_proofs));
21 }));
22 default:
23 return state;
24 }
25 };
This page took 0.138118 seconds and 4 git commands to generate.