Rocket.Chat.ReactNative/app/actions/settings.ts

35 lines
784 B
TypeScript
Raw Normal View History

2022-01-14 21:00:04 +00:00
import { Action } from 'redux';
import { TSettingsState, TSupportedSettings, TSettingsValues } from '../reducers/settings';
2022-01-14 21:00:04 +00:00
import { SETTINGS } from './actionsTypes';
interface IAddSettings extends Action {
payload: TSettingsState;
2022-01-14 21:00:04 +00:00
}
interface IUpdateSettings extends Action {
payload: { id: TSupportedSettings; value: TSettingsValues };
2022-01-14 21:00:04 +00:00
}
export type IActionSettings = IAddSettings & IUpdateSettings;
export function addSettings(settings: TSettingsState): IAddSettings {
2022-01-14 21:00:04 +00:00
return {
type: SETTINGS.ADD,
payload: settings
};
}
export function updateSettings(id: TSupportedSettings, value: TSettingsValues): IUpdateSettings {
2022-01-14 21:00:04 +00:00
return {
type: SETTINGS.UPDATE,
payload: { id, value }
};
}
export function clearSettings(): Action {
return {
type: SETTINGS.CLEAR
};
}