E.W.O. Next / All files / src/client actions.ts

75% Statements 12/16
100% Branches 2/2
33.33% Functions 2/6
91.67% Lines 11/12

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              3x 3x 3x 3x 3x 3x 3x     3x         3x           12x         3x      
/**
 * @module Client.Redux
 */
 
import { CharacterFrontend, ViewFrontend } from '@models';
import { Dispatch } from 'redux';
 
export enum Actions {
  REFRESH_CHARACTERS = 'REFRESH_CHARACTERS',
  REFRESH_MAPS = 'REFRESH_MAPS',
  SET_SELECTED_CHARACTER = 'SET_SELECTED_CHARACTER',
  SOCKET_ACTION = 'SOCKET_ACTION',
  SOCKET_ACTIONS = 'SOCKET_ACTIONS',
  SOCKET_UPDATE = 'SOCKET_UPDATE',
}
 
export const refreshCharacters = (characters: Record<string, CharacterFrontend>) => ({
  type: Actions.REFRESH_CHARACTERS,
  characters,
});
 
export const refreshMaps = (mat: number, views: ViewFrontend[]) => ({
  type: Actions.REFRESH_MAPS,
  mat,
  views,
});
 
export const setSelectedCharacter = (mat: number) => ({
  type: Actions.SET_SELECTED_CHARACTER,
  mat,
});
 
export const selectCharacter = (mat: number) => (dispatch: Dispatch<any>) => {
  dispatch(setSelectedCharacter(mat));
};