2020-01-18 02:07:52 +05:30
|
|
|
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;
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
2017-12-31 00:34:31 +05:30
|
|
|
|
|
|
|
export function add(account: Account): AddAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
return {
|
|
|
|
type: 'accounts:add',
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
interface RemoveAction extends ReduxAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
type: 'accounts:remove';
|
|
|
|
payload: Account;
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
|
|
|
|
2017-12-31 00:34:31 +05:30
|
|
|
export function remove(account: Account): RemoveAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
return {
|
|
|
|
type: 'accounts:remove',
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
interface ActivateAction extends ReduxAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
type: 'accounts:activate';
|
|
|
|
payload: Account;
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
|
|
|
|
2017-12-31 00:34:31 +05:30
|
|
|
export function activate(account: Account): ActivateAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
return {
|
|
|
|
type: 'accounts:activate',
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
interface ResetAction extends ReduxAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
type: 'accounts:reset';
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
|
|
|
|
2017-12-31 00:34:31 +05:30
|
|
|
export function reset(): ResetAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
return {
|
|
|
|
type: 'accounts:reset',
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
|
|
|
|
2020-01-18 02:07:52 +05:30
|
|
|
interface UpdateTokenAction extends ReduxAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
type: 'accounts:updateToken';
|
|
|
|
payload: string;
|
2020-01-18 02:07:52 +05:30
|
|
|
}
|
|
|
|
|
2017-12-31 00:34:31 +05:30
|
|
|
export function updateToken(token: string): UpdateTokenAction {
|
2020-05-24 04:38:24 +05:30
|
|
|
return {
|
|
|
|
type: 'accounts:updateToken',
|
|
|
|
payload: token,
|
|
|
|
};
|
2017-01-27 11:59:20 +05:30
|
|
|
}
|
2020-01-18 02:07:52 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
export type Action = AddAction | RemoveAction | ActivateAction | ResetAction | UpdateTokenAction;
|