pulsar-web/src/store/channel/actions.ts
2026-01-02 16:23:21 +01:00

45 lines
1.5 KiB
TypeScript

import {
ICreateChannelRequest,
IFetchChannelResponse,
ICreateChannelResponse,
IUpdateChannelResponse,
IRemoveChannelResponse,
} from "../../api/channel";
enum ChannelActionTypes {
FETCH_CHANNEL_START = "FETCH_COMMUNITY_START",
FETCH_CHANNEL_FINISH = "FETCH_COMMUNITY_FINISH",
CREATE_CHANNEL_START = "CREATE_CHANNEL_START",
CREATE_CHANNEL_FINISH = "CREATE_CHANNEL_FINISH",
UPDATE_CHANNEL_START = "UPDATE_CHANNEL_START",
UPDATE_CHANNEL_FINISH = "UPDATE_CHANNEL_FINISH",
REMOVE_CHANNEL_START = "REMOVE_CHANNEL_START",
REMOVE_CHANNEL_FINISH = "REMOVE_CHANNEL_FINISH",
}
type ChannelAction =
| { type: ChannelActionTypes.FETCH_CHANNEL_START; payload: string }
| {
type: ChannelActionTypes.FETCH_CHANNEL_FINISH;
payload: IFetchChannelResponse;
}
| {
type: ChannelActionTypes.CREATE_CHANNEL_START;
payload: ICreateChannelRequest;
}
| {
type: ChannelActionTypes.CREATE_CHANNEL_FINISH;
payload: ICreateChannelResponse;
}
| { type: ChannelActionTypes.UPDATE_CHANNEL_START; payload: string }
| {
type: ChannelActionTypes.UPDATE_CHANNEL_FINISH;
payload: IUpdateChannelResponse;
}
| { type: ChannelActionTypes.REMOVE_CHANNEL_START; payload: string }
| {
type: ChannelActionTypes.REMOVE_CHANNEL_FINISH;
payload: IRemoveChannelResponse;
};
export { ChannelActionTypes, type ChannelAction };