mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-12 16:29:01 +05:30
79 lines
1.3 KiB
TypeScript
79 lines
1.3 KiB
TypeScript
import {
|
|
Account,
|
|
AddAction,
|
|
RemoveAction,
|
|
ActivateAction,
|
|
UpdateTokenAction,
|
|
ResetAction,
|
|
} from '../reducer';
|
|
|
|
export const ADD = 'accounts:add';
|
|
/**
|
|
* @private
|
|
*
|
|
* @param {Account} account
|
|
*
|
|
* @returns {object} - action definition
|
|
*/
|
|
export function add(account: Account): AddAction {
|
|
return {
|
|
type: ADD,
|
|
payload: account,
|
|
};
|
|
}
|
|
|
|
export const REMOVE = 'accounts:remove';
|
|
/**
|
|
* @private
|
|
*
|
|
* @param {Account} account
|
|
*
|
|
* @returns {object} - action definition
|
|
*/
|
|
export function remove(account: Account): RemoveAction {
|
|
return {
|
|
type: REMOVE,
|
|
payload: account,
|
|
};
|
|
}
|
|
|
|
export const ACTIVATE = 'accounts:activate';
|
|
/**
|
|
* @private
|
|
*
|
|
* @param {Account} account
|
|
*
|
|
* @returns {object} - action definition
|
|
*/
|
|
export function activate(account: Account): ActivateAction {
|
|
return {
|
|
type: ACTIVATE,
|
|
payload: account,
|
|
};
|
|
}
|
|
|
|
export const RESET = 'accounts:reset';
|
|
/**
|
|
* @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,
|
|
};
|
|
}
|