chore: update settings value types
This commit is contained in:
parent
e0dc8b2e13
commit
4fad0cafad
|
@ -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 }
|
||||||
|
|
|
@ -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 = {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue