chore: update settings value types

This commit is contained in:
GleidsonDaniel 2022-01-20 14:41:04 -03:00
parent e0dc8b2e13
commit 4fad0cafad
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { Action } from 'redux'; import { Action } from 'redux';
import { ISettings } from '../reducers/settings'; import { ISettings, TSettings } from '../reducers/settings';
import { SETTINGS } from './actionsTypes'; import { SETTINGS } from './actionsTypes';
interface IAddSettings extends Action { interface IAddSettings extends Action {
@ -8,7 +8,7 @@ interface IAddSettings extends Action {
} }
interface IUpdateSettings extends Action { interface IUpdateSettings extends Action {
payload: { id: string; value: string }; payload: { id: string; value: TSettings };
} }
export type IActionSettings = IAddSettings & IUpdateSettings; export type IActionSettings = IAddSettings & IUpdateSettings;
@ -20,7 +20,7 @@ export function addSettings(settings: ISettings): IAddSettings {
}; };
} }
export function updateSettings(id: string, value: string): IUpdateSettings { export function updateSettings(id: string, value: TSettings): IUpdateSettings {
return { return {
type: SETTINGS.UPDATE, type: SETTINGS.UPDATE,
payload: { id, value } payload: { id, value }

View File

@ -1,8 +1,9 @@
import { IActionSettings } from '../actions/settings'; import { IActionSettings } from '../actions/settings';
import { SETTINGS } from '../actions/actionsTypes'; import { SETTINGS } from '../actions/actionsTypes';
// TODO UPDATE SETTINGS TYPE export type TSettings = string | number | boolean;
export type ISettings = Record<string, any>;
export type ISettings = Record<string, TSettings>;
export const initialState: ISettings = {}; export const initialState: ISettings = {};