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

63 lines
1.3 KiB
TypeScript
Raw Normal View History

import { Action as ReduxAction } from 'redux';
import { Account } from 'app/components/accounts/reducer';
interface AddAction extends ReduxAction {
2020-05-24 04:38:24 +05:30
type: 'accounts:add';
payload: Account;
}
export function add(account: Account): AddAction {
2020-05-24 04:38:24 +05:30
return {
type: 'accounts:add',
payload: account,
};
}
interface RemoveAction extends ReduxAction {
2020-05-24 04:38:24 +05:30
type: 'accounts:remove';
payload: Account;
}
export function remove(account: Account): RemoveAction {
2020-05-24 04:38:24 +05:30
return {
type: 'accounts:remove',
payload: account,
};
}
interface ActivateAction extends ReduxAction {
2020-05-24 04:38:24 +05:30
type: 'accounts:activate';
payload: Account;
}
export function activate(account: Account): ActivateAction {
2020-05-24 04:38:24 +05:30
return {
type: 'accounts:activate',
payload: account,
};
}
interface ResetAction extends ReduxAction {
2020-05-24 04:38:24 +05:30
type: 'accounts:reset';
}
export function reset(): ResetAction {
2020-05-24 04:38:24 +05:30
return {
type: 'accounts:reset',
};
}
interface UpdateTokenAction extends ReduxAction {
2020-05-24 04:38:24 +05:30
type: 'accounts:updateToken';
payload: string;
}
export function updateToken(token: string): UpdateTokenAction {
2020-05-24 04:38:24 +05:30
return {
type: 'accounts:updateToken',
payload: token,
};
}
2020-05-24 04:38:24 +05:30
export type Action = AddAction | RemoveAction | ActivateAction | ResetAction | UpdateTokenAction;