Update selected item color in Pass menu
[ProtonMail-WebClient.git] / packages / pass / store / reducers / invites.ts
blob8f86e2708c6ec56621bf45316fb0f95772f2b398
1 import type { Reducer } from 'redux';
3 import { inviteAcceptSuccess, inviteRejectSuccess, syncInvites } from '@proton/pass/store/actions';
4 import type { Invite } from '@proton/pass/types/data/invites';
5 import { or } from '@proton/pass/utils/fp/predicates';
6 import { objectDelete } from '@proton/pass/utils/object/delete';
8 export type InviteState = Record<string, Invite>;
10 const reducer: Reducer<InviteState> = (state = {}, action) => {
11     if (syncInvites.match(action)) return action.payload;
13     if (or(inviteAcceptSuccess.match, inviteRejectSuccess.match)(action)) {
14         return objectDelete(state, action.payload.token);
15     }
17     return state;
20 export default reducer;