HEX
Server: Apache
System: Linux webm006.cluster111.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: perditaeyz (838589)
PHP: 7.3.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/perditaeyz/www/wp-content/plugins/better-wp-security/core/packages/data/src/reducers.js
/**
 * Internal dependencies
 */
import { RECEIVE_ACTOR_TYPES, RECEIVE_ACTORS, RECEIVE_INDEX, RECEIVE_USER } from './actions';

const DEFAULT_STATE = {
	users: {
		byId: {},
	},
	index: null,
	actors: {
		types: [],
		byType: {},
	},
};

export default function reducer( state = DEFAULT_STATE, action ) {
	switch ( action.type ) {
		case RECEIVE_INDEX:
			return {
				...state,
				index: action.index,
			};
		case RECEIVE_USER:
			return {
				...state,
				users: {
					...state.users,
					byId: {
						...state.users.byId,
						[ action.user.id ]: action.user,
					},
				},
			};
		case RECEIVE_ACTOR_TYPES:
			return {
				...state,
				actors: {
					...state.actors,
					types: action.types,
				},
			};
		case RECEIVE_ACTORS:
			return {
				...state,
				actors: {
					...state.actors,
					byType: {
						...state.actors.byType,
						[ action.actorType ]: action.actors,
					},
				},
			};
		default:
			return state;
	}
}