diff options
author | Alex Gessner <alex.gessner@gmail.com> | 2019-03-28 13:01:09 -0400 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-03-28 18:01:09 +0100 |
commit | 69141dca26f8a28d3aff63387b1c8d2bba7fdfa3 (patch) | |
tree | 258b59ecbce99855bccb4fd679a5eb3d9938acb0 /app/javascript/mastodon/reducers/identity_proofs.js | |
parent | 026dd75208223a8ceb8f3e82699a123d68b9a1c7 (diff) |
squashed identity proof updates (#10375)
Diffstat (limited to 'app/javascript/mastodon/reducers/identity_proofs.js')
-rw-r--r-- | app/javascript/mastodon/reducers/identity_proofs.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/identity_proofs.js b/app/javascript/mastodon/reducers/identity_proofs.js new file mode 100644 index 000000000..58af0a5fa --- /dev/null +++ b/app/javascript/mastodon/reducers/identity_proofs.js @@ -0,0 +1,25 @@ +import { Map as ImmutableMap, fromJS } from 'immutable'; +import { + IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST, + IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS, + IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, +} from '../actions/identity_proofs'; + +const initialState = ImmutableMap(); + +export default function identityProofsReducer(state = initialState, action) { + switch(action.type) { + case IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST: + return state.set('isLoading', true); + case IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL: + return state.set('isLoading', false); + case IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS: + return state.update(identity_proofs => identity_proofs.withMutations(map => { + map.set('isLoading', false); + map.set('loaded', true); + map.set(action.accountId, fromJS(action.identity_proofs)); + })); + default: + return state; + } +}; |