forked from Ivasoft/mattermost-mobile
* Load team member and roles in the WebSocket event * Split WebSocket actions and events into multiple files
33 lines
892 B
TypeScript
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,
|
|
};
|
|
} |