verdnatura-chat/app/actions/selectedUsers.ts

44 lines
785 B
TypeScript
Raw Normal View History

import { Action } from 'redux';
2021-12-23 13:20:38 +00:00
import { ISelectedUser } from '../reducers/selectedUsers';
import * as types from './actionsTypes';
type TUser = {
2021-12-23 13:20:38 +00:00
user: ISelectedUser;
};
type IAction = Action & TUser;
interface ISetLoading extends Action {
loading: boolean;
}
export type TActionSelectedUsers = IAction & ISetLoading;
2021-12-23 13:20:38 +00:00
export function addUser(user: ISelectedUser): IAction {
return {
type: types.SELECTED_USERS.ADD_USER,
user
};
}
2021-12-23 13:20:38 +00:00
export function removeUser(user: ISelectedUser): IAction {
return {
2021-12-22 12:28:21 +00:00
type: types.SELECTED_USERS.REMOVE_USER,
user
};
}
export function reset(): Action {
return {
type: types.SELECTED_USERS.RESET
};
}
export function setLoading(loading: boolean): ISetLoading {
return {
type: types.SELECTED_USERS.SET_LOADING,
loading
};
}