Files
mattermost-mobile/app/actions/websocket/roles.ts
Elias Nahum ac2a3a143a MM-24895 Load team member and roles in the WebSocket event (#4603)
* Load team member and roles in the WebSocket event

* Split WebSocket actions and events into multiple files
2020-07-23 10:19:54 -07:00

33 lines
892 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {RoleTypes} from '@mm-redux/action_types';
import {GenericAction} from '@mm-redux/types/actions';
import {WebSocketMessage} from '@mm-redux/types/websocket';
export function handleRoleAddedEvent(msg: WebSocketMessage): GenericAction {
const role = JSON.parse(msg.data.role);
return {
type: RoleTypes.RECEIVED_ROLE,
data: role,
};
}
export function handleRoleRemovedEvent(msg: WebSocketMessage): GenericAction {
const role = JSON.parse(msg.data.role);
return {
type: RoleTypes.ROLE_DELETED,
data: role,
};
}
export function handleRoleUpdatedEvent(msg: WebSocketMessage): GenericAction {
const role = JSON.parse(msg.data.role);
return {
type: RoleTypes.RECEIVED_ROLE,
data: role,
};
}