Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | 1x 1x | import { createReducer } from "@reduxjs/toolkit"; import { Action } from "../../../redux"; import { GET_USER_ORGS_ACTION, CREATE_ORGANISATION_ACTION, RETRIEVE_ORGS_ACTION, EDIT_ORGANISATION_ACTION, GET_ORG_ACTION, GET_ORG_SOURCES_ACTION, GET_ORG_COLLECTIONS_ACTION, GET_ORG_MEMBERS_ACTION, SHOW_ADD_MEMBER_DIALOG, HIDE_ADD_MEMBER_DIALOG, SHOW_DELETE_MEMBER_DIALOG, HIDE_DELETE_MEMBER_DIALOG, TOGGLE_SHOW_VERIFIED_ACTION } from "./actionTypes"; import { LOGOUT_ACTION } from "../../authentication/redux/actionTypes"; import { APIOrganisation, OrganisationState } from "../types"; const initialState: OrganisationState = { organisations: [], organisation: {} as APIOrganisation, showAddMemberDialog: false, showDeleteMemberDialog: undefined, showOnlyVerified: false }; export const reducer = createReducer(initialState, { [TOGGLE_SHOW_VERIFIED_ACTION]: (state, action) => ({ ...state, showOnlyVerified: !state.showOnlyVerified }), [GET_USER_ORGS_ACTION]: (state, { payload, responseMeta }: Action) => ({ ...state, organisations: payload, meta: responseMeta }), [RETRIEVE_ORGS_ACTION]: ( state, { actionIndex, payload, responseMeta }: Action ) => { state.organisations[actionIndex] = { items: payload, responseMeta }; }, [CREATE_ORGANISATION_ACTION]: (state, action) => ({ ...state, newOrganisation: action.payload }), [EDIT_ORGANISATION_ACTION]: (state, action) => ({ ...state, editedOrganisation: action.payload }), [GET_ORG_ACTION]: (state, action) => ({ ...state, organisation: action.payload }), [GET_ORG_SOURCES_ACTION]: (state, action) => ({ ...state, orgSources: action.payload }), [GET_ORG_COLLECTIONS_ACTION]: (state, action) => ({ ...state, orgCollections: action.payload }), [GET_ORG_MEMBERS_ACTION]: (state, action) => ({ ...state, orgMembers: action.payload }), [SHOW_ADD_MEMBER_DIALOG]: state => ({ ...state, showAddMemberDialog: true }), [HIDE_ADD_MEMBER_DIALOG]: state => ({ ...state, showAddMemberDialog: false }), [SHOW_DELETE_MEMBER_DIALOG]: (state, action) => ({ ...state, showDeleteMemberDialog: action.payload }), [HIDE_DELETE_MEMBER_DIALOG]: (state, action) => ({ ...state, showDeleteMemberDialog: action.payload }), [LOGOUT_ACTION]: () => { return initialState; } }); export { reducer as default }; |