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);
20 export default reducer;