asynqmon/ui/src/actions/settingsActions.ts

30 lines
688 B
TypeScript
Raw Normal View History

2020-11-24 06:54:00 -08:00
// List of settings related action types.
2021-01-12 15:55:56 -08:00
export const POLL_INTERVAL_CHANGE = 'POLL_INTERVAL_CHANGE';
export const TOGGLE_DARK_THEME = 'TOGGLE_DARK_THEME';
2020-11-24 06:54:00 -08:00
interface PollIntervalChangeAction {
type: typeof POLL_INTERVAL_CHANGE;
value: number; // new poll interval value in seconds
}
2021-01-12 15:55:56 -08:00
interface ToggleDarkThemeAction {
type: typeof TOGGLE_DARK_THEME;
}
2020-11-24 06:54:00 -08:00
// Union of all settings related action types.
2021-01-12 15:55:56 -08:00
export type SettingsActionTypes = PollIntervalChangeAction | ToggleDarkThemeAction;
2020-11-24 06:54:00 -08:00
export function pollIntervalChange(value: number) {
return {
type: POLL_INTERVAL_CHANGE,
value,
};
}
2021-01-12 15:55:56 -08:00
export function toggleDarkTheme() {
return {
type: TOGGLE_DARK_THEME
}
}