2019-12-07 16:58:52 +05:30
|
|
|
import {
|
2019-11-27 14:33:32 +05:30
|
|
|
Account,
|
|
|
|
AddAction,
|
|
|
|
RemoveAction,
|
|
|
|
ActivateAction,
|
|
|
|
UpdateTokenAction,
|
|
|
|
ResetAction,
|
2017-12-31 00:34:31 +05:30
|
|
|
} from '../reducer';
|
|
|
|
|
2017-01-27 11:59:20 +05:30
|
|
|
export const ADD = 'accounts:add';
|
|
|
|
/**
|
2019-12-07 16:58:52 +05:30
|
|
|
* @private
|
2017-01-27 11:59:20 +05:30
|
|
|
*
|
|
|
|
* @param {Account} account
|
|
|
|
*
|
2019-11-27 14:33:32 +05:30
|
|
|
* @returns {object} - action definition
|
2017-01-27 11:59:20 +05:30
|
|
|
*/
|
2017-12-31 00:34:31 +05:30
|
|
|
export function add(account: Account): AddAction {
|
2019-11-27 14:33:32 +05:30
|
|
|
return {
|
|
|
|
type: ADD,
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
export const REMOVE = 'accounts:remove';
|
|
|
|
/**
|
2019-12-07 16:58:52 +05:30
|
|
|
* @private
|
2017-01-27 11:59:20 +05:30
|
|
|
*
|
|
|
|
* @param {Account} account
|
|
|
|
*
|
2019-11-27 14:33:32 +05:30
|
|
|
* @returns {object} - action definition
|
2017-01-27 11:59:20 +05:30
|
|
|
*/
|
2017-12-31 00:34:31 +05:30
|
|
|
export function remove(account: Account): RemoveAction {
|
2019-11-27 14:33:32 +05:30
|
|
|
return {
|
|
|
|
type: REMOVE,
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
export const ACTIVATE = 'accounts:activate';
|
|
|
|
/**
|
2019-12-07 16:58:52 +05:30
|
|
|
* @private
|
2017-01-27 11:59:20 +05:30
|
|
|
*
|
|
|
|
* @param {Account} account
|
|
|
|
*
|
2019-11-27 14:33:32 +05:30
|
|
|
* @returns {object} - action definition
|
2017-01-27 11:59:20 +05:30
|
|
|
*/
|
2017-12-31 00:34:31 +05:30
|
|
|
export function activate(account: Account): ActivateAction {
|
2019-11-27 14:33:32 +05:30
|
|
|
return {
|
|
|
|
type: ACTIVATE,
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
export const RESET = 'accounts:reset';
|
|
|
|
/**
|
2019-12-07 16:58:52 +05:30
|
|
|
* @private
|
2017-01-27 11:59:20 +05:30
|
|
|
*
|
2019-11-27 14:33:32 +05:30
|
|
|
* @returns {object} - action definition
|
2017-01-27 11:59:20 +05:30
|
|
|
*/
|
2017-12-31 00:34:31 +05:30
|
|
|
export function reset(): ResetAction {
|
2019-11-27 14:33:32 +05:30
|
|
|
return {
|
|
|
|
type: RESET,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
export const UPDATE_TOKEN = 'accounts:updateToken';
|
|
|
|
/**
|
|
|
|
* @param {string} token
|
|
|
|
*
|
2019-11-27 14:33:32 +05:30
|
|
|
* @returns {object} - action definition
|
2017-01-27 11:59:20 +05:30
|
|
|
*/
|
2017-12-31 00:34:31 +05:30
|
|
|
export function updateToken(token: string): UpdateTokenAction {
|
2019-11-27 14:33:32 +05:30
|
|
|
return {
|
|
|
|
type: UPDATE_TOKEN,
|
|
|
|
payload: token,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|