mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-03 14:23:12 +02:00
31 lines
677 B
TypeScript
31 lines
677 B
TypeScript
|
import { State } from '../interfaces';
|
||
|
import { ACTION_TYPES } from '../constants';
|
||
|
|
||
|
export interface ClearAllAction {
|
||
|
type: typeof ACTION_TYPES.CLEAR_ALL;
|
||
|
}
|
||
|
|
||
|
export interface ResetToAction {
|
||
|
type: typeof ACTION_TYPES.RESET_TO;
|
||
|
state: State;
|
||
|
}
|
||
|
|
||
|
export interface SetIsLoadingAction {
|
||
|
type: typeof ACTION_TYPES.SET_IS_LOADING;
|
||
|
isLoading: boolean;
|
||
|
}
|
||
|
|
||
|
export const clearAll = (): ClearAllAction => ({
|
||
|
type: ACTION_TYPES.CLEAR_ALL,
|
||
|
});
|
||
|
|
||
|
export const resetTo = (state: State): ResetToAction => ({
|
||
|
type: ACTION_TYPES.RESET_TO,
|
||
|
state,
|
||
|
});
|
||
|
|
||
|
export const setIsLoading = (isLoading: boolean): SetIsLoadingAction => ({
|
||
|
type: ACTION_TYPES.SET_IS_LOADING,
|
||
|
isLoading,
|
||
|
});
|