summaryrefslogtreecommitdiff
path: root/server/web/src/redux/actions.ts
blob: 887b80855888f2b7be55586161608e94ba40541b (plain)
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
import { IActivity } from '../interfaces/Activity.interface';
import { IClient } from '../interfaces/Client.interface';

export type ClientsLoadType = { type: 'CLIENTS_LOAD'; payload: Map<string, IClient>; };
export type SessionLoadType = { type: 'SESSION_LOAD'; payload: Set<string>; };
export type SessionAllType = { type: 'SESSION_ALL'; };
export type SessionCloseType = { type: 'SESSION_CLOSE'; };
export type SessionAddType = { type: 'SESSION_ADD'; payload: string; };
export type SessionRemoveType = { type: 'SESSION_REMOVE'; payload: string; };
export type ClientAddType = { type: 'CLIENT_ADD'; payload: { unique_id: string, client: IClient; }; };
export type ClientRemoveType = { type: 'CLIENT_REMOVE'; payload: string; };
export type ActivityUpdateType = { type: 'ACTIVITY_UPDATE'; payload: IActivity; };

export const clientsLoad = (clients: Map<string, IClient>): ClientsLoadType => ({
    type: 'CLIENTS_LOAD',
    payload: clients
});

export const sessionLoad = (session: Set<string>): SessionLoadType => ({
    type: 'SESSION_LOAD',
    payload: session
});

export const sessionAll = (): SessionAllType => ({
    type: 'SESSION_ALL'
});

export const sessionClose = (): SessionCloseType => ({
    type: 'SESSION_CLOSE'
});

export const sessionAdd = (unique_id: string): SessionAddType => ({
    type: 'SESSION_ADD',
    payload: unique_id
});

export const sessionRemove = (unique_id: string): SessionRemoveType => ({
    type: 'SESSION_REMOVE',
    payload: unique_id
});

export const clientAdd = (unique_id: string, client: IClient): ClientAddType => ({
    type: 'CLIENT_ADD',
    payload: { unique_id, client }
});

export const clientRemove = (unique_id: string): ClientRemoveType => ({
    type: 'CLIENT_REMOVE',
    payload: unique_id
});

export const activityUpdate = (activity: IActivity): ActivityUpdateType => ({
    type: 'ACTIVITY_UPDATE',
    payload: activity
});