2022-01-14 22:06:55 +00:00
|
|
|
import { Action } from 'redux';
|
|
|
|
|
|
|
|
import { ROOMS } from './actionsTypes';
|
|
|
|
|
|
|
|
export interface IRoomsRequest extends Action {
|
|
|
|
params: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ISetSearch extends Action {
|
|
|
|
searchText: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IRoomsFailure extends Action {
|
2022-01-17 14:20:29 +00:00
|
|
|
err: Record<string, any> | string;
|
2022-01-14 22:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export type IRoomsAction = IRoomsRequest & ISetSearch & IRoomsFailure;
|
|
|
|
|
|
|
|
export function roomsRequest(
|
|
|
|
params: {
|
|
|
|
allData: boolean;
|
|
|
|
} = { allData: false }
|
|
|
|
): IRoomsRequest {
|
|
|
|
return {
|
|
|
|
type: ROOMS.REQUEST,
|
|
|
|
params
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function roomsSuccess(): Action {
|
|
|
|
return {
|
|
|
|
type: ROOMS.SUCCESS
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function roomsFailure(err: string): IRoomsFailure {
|
|
|
|
return {
|
|
|
|
type: ROOMS.FAILURE,
|
|
|
|
err
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function roomsRefresh(): Action {
|
|
|
|
return {
|
|
|
|
type: ROOMS.REFRESH
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function setSearch(searchText: string): ISetSearch {
|
|
|
|
return {
|
|
|
|
type: ROOMS.SET_SEARCH,
|
|
|
|
searchText
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function closeServerDropdown(): Action {
|
|
|
|
return {
|
|
|
|
type: ROOMS.CLOSE_SERVER_DROPDOWN
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function toggleServerDropdown(): Action {
|
|
|
|
return {
|
|
|
|
type: ROOMS.TOGGLE_SERVER_DROPDOWN
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function openSearchHeader(): Action {
|
|
|
|
return {
|
|
|
|
type: ROOMS.OPEN_SEARCH_HEADER
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function closeSearchHeader(): Action {
|
|
|
|
return {
|
|
|
|
type: ROOMS.CLOSE_SEARCH_HEADER
|
|
|
|
};
|
|
|
|
}
|