2020-01-17 23:37:52 +03:00
|
|
|
import { Action as ReduxAction } from 'redux';
|
|
|
|
import { Account } from 'app/components/accounts/reducer';
|
|
|
|
|
|
|
|
interface AddAction extends ReduxAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
type: 'accounts:add';
|
|
|
|
payload: Account;
|
2020-01-17 23:37:52 +03:00
|
|
|
}
|
2017-12-30 21:04:31 +02:00
|
|
|
|
|
|
|
export function add(account: Account): AddAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
return {
|
|
|
|
type: 'accounts:add',
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 08:29:20 +02:00
|
|
|
}
|
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
interface RemoveAction extends ReduxAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
type: 'accounts:remove';
|
|
|
|
payload: Account;
|
2020-01-17 23:37:52 +03:00
|
|
|
}
|
|
|
|
|
2017-12-30 21:04:31 +02:00
|
|
|
export function remove(account: Account): RemoveAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
return {
|
|
|
|
type: 'accounts:remove',
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 08:29:20 +02:00
|
|
|
}
|
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
interface ActivateAction extends ReduxAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
type: 'accounts:activate';
|
|
|
|
payload: Account;
|
2020-01-17 23:37:52 +03:00
|
|
|
}
|
|
|
|
|
2017-12-30 21:04:31 +02:00
|
|
|
export function activate(account: Account): ActivateAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
return {
|
|
|
|
type: 'accounts:activate',
|
|
|
|
payload: account,
|
|
|
|
};
|
2017-01-27 08:29:20 +02:00
|
|
|
}
|
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
interface ResetAction extends ReduxAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
type: 'accounts:reset';
|
2020-01-17 23:37:52 +03:00
|
|
|
}
|
|
|
|
|
2017-12-30 21:04:31 +02:00
|
|
|
export function reset(): ResetAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
return {
|
|
|
|
type: 'accounts:reset',
|
|
|
|
};
|
2017-01-27 08:29:20 +02:00
|
|
|
}
|
|
|
|
|
2020-01-17 23:37:52 +03:00
|
|
|
interface UpdateTokenAction extends ReduxAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
type: 'accounts:updateToken';
|
|
|
|
payload: string;
|
2020-01-17 23:37:52 +03:00
|
|
|
}
|
|
|
|
|
2017-12-30 21:04:31 +02:00
|
|
|
export function updateToken(token: string): UpdateTokenAction {
|
2020-05-24 02:08:24 +03:00
|
|
|
return {
|
|
|
|
type: 'accounts:updateToken',
|
|
|
|
payload: token,
|
|
|
|
};
|
2017-01-27 08:29:20 +02:00
|
|
|
}
|
2020-01-17 23:37:52 +03:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
export type Action = AddAction | RemoveAction | ActivateAction | ResetAction | UpdateTokenAction;
|