verdnatura-chat/app/actions/createDiscussion.ts

47 lines
997 B
TypeScript
Raw Normal View History

2022-02-28 18:00:47 +00:00
import { Action } from 'redux';
import { CREATE_DISCUSSION } from './actionsTypes';
2022-05-30 22:02:08 +00:00
export interface ICreateDiscussionRequestData {
prid: string;
pmid?: string;
t_name?: string;
reply?: string;
users: string[];
encrypted?: boolean;
}
2022-02-28 18:00:47 +00:00
interface ICreateDiscussionRequest extends Action {
2022-05-30 22:02:08 +00:00
data: ICreateDiscussionRequestData;
2022-02-28 18:00:47 +00:00
}
interface ICreateDiscussionSuccess extends Action {
data: any;
}
interface ICreateDiscussionFailure extends Action {
err: any;
}
export type TActionCreateDiscussion = ICreateDiscussionRequest & ICreateDiscussionSuccess & ICreateDiscussionFailure;
export function createDiscussionRequest(data: any): ICreateDiscussionRequest {
return {
type: CREATE_DISCUSSION.REQUEST,
data
};
}
export function createDiscussionSuccess(data: any): ICreateDiscussionSuccess {
return {
type: CREATE_DISCUSSION.SUCCESS,
data
};
}
export function createDiscussionFailure(err: any): ICreateDiscussionFailure {
return {
type: CREATE_DISCUSSION.FAILURE,
err
};
}