Created
May 5, 2017 13:27
-
-
Save dfranciosi/c3ce0cf36986f96bdaec93bfba679cbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
import type { Message, SuccessMessage, ErrorMessage, Schedule } from './types'; | |
//eslint-disable-next-line | |
export const schedulingMessage = (operation: string, targetNodeId: number, payload: Schedule): Message => ({ | |
cmd: `schedule::${operation}`, | |
args: [targetNodeId, payload], | |
}); | |
//eslint-disable-next-line | |
export const applianceMessage = (operation: string, targetNodeId: number, payload: Object): Message => ({ | |
cmd: `appliance::${operation}`, | |
args: [targetNodeId, payload], | |
}); | |
//eslint-disable-next-line | |
export const backupMessage = (operation: string, targetNodeId: number, payload: Object): Message => ({ | |
cmd: `backup::${operation}`, | |
args: [targetNodeId, payload], | |
}); | |
export const stateChangeMessage = (whoami: string, state: string): Message => ({ | |
cmd: 'state::change', | |
args: [whoami, state], | |
}); | |
export const successMessage = (data: any = []): SuccessMessage => ({ | |
status: 'success', | |
data, | |
}); | |
export const errorMessage = (message: string): ErrorMessage => ({ | |
status: 'error', | |
message, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment