accounts-frontend/packages/app/components/accounts/actions/pure-actions.ts

79 lines
1.3 KiB
TypeScript
Raw Normal View History

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