2022-02-09 20:44:53 +00:00
|
|
|
import { ACTIVE_USERS } from '../actions/actionsTypes';
|
2022-02-18 13:53:36 +00:00
|
|
|
import { TApplicationActions } from '../definitions';
|
|
|
|
import { UserStatus } from '../definitions/UserStatus';
|
2022-01-11 13:48:01 +00:00
|
|
|
|
|
|
|
export interface IActiveUser {
|
2022-02-18 13:53:36 +00:00
|
|
|
status: UserStatus;
|
2022-01-18 15:04:40 +00:00
|
|
|
statusText: string;
|
2022-01-11 13:48:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IActiveUsers {
|
|
|
|
[key: string]: IActiveUser;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const initialState: IActiveUsers = {};
|
|
|
|
|
|
|
|
export default function activeUsers(state = initialState, action: TApplicationActions): IActiveUsers {
|
|
|
|
switch (action.type) {
|
2022-02-09 20:44:53 +00:00
|
|
|
case ACTIVE_USERS.SET:
|
2022-01-11 13:48:01 +00:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
...action.activeUsers
|
|
|
|
};
|
2022-02-09 20:44:53 +00:00
|
|
|
case ACTIVE_USERS.CLEAR:
|
|
|
|
return initialState;
|
2022-01-11 13:48:01 +00:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|