vn-verdnaturachat/app/actions/settings.ts

35 lines
707 B
TypeScript
Raw Normal View History

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