From 952b1b6a8d022a21e1f3e2ce2766256e15f02d52 Mon Sep 17 00:00:00 2001 From: Teddy Cornaut Date: Mon, 31 Aug 2020 15:29:38 +0200 Subject: [PATCH] Correction des variables en constantes --- .../DecisionSupportFilePage/OptionsSection.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/components/DecisionSupportFilePage/OptionsSection.tsx b/client/src/components/DecisionSupportFilePage/OptionsSection.tsx index a87e4a7..7c4e256 100644 --- a/client/src/components/DecisionSupportFilePage/OptionsSection.tsx +++ b/client/src/components/DecisionSupportFilePage/OptionsSection.tsx @@ -51,23 +51,23 @@ export const OptionsSection: FunctionComponent = ({ dsf, up } const onAddOptionClick = (evt: MouseEvent) => { - var options = JSON.parse(JSON.stringify(state.section.options)) - var option = newOption("Décision", "", ""); + const options = JSON.parse(JSON.stringify(state.section.options)) + const option = newOption("Décision", "", ""); options.push(option); setState(state => ({ ...state, changed: true, section: { ...state.section, options }})); }; - const onOptionChange = (id: string, attrName: string, evt: ChangeEvent) => { + const onOptionChange = (id: number, attrName: string, evt: ChangeEvent) => { const target = evt.currentTarget; const value = target.hasOwnProperty('checked') ? target.checked : target.value; - var options = JSON.parse(JSON.stringify(state.section.options)) + const options = JSON.parse(JSON.stringify(state.section.options)) options[id][attrName] = value; setState(state => ({ ...state, changed: true, section: { ...state.section, options }})); }; - const onRemoveOptionClick = (id: string, evt: MouseEvent) => { + const onRemoveOptionClick = (id: number, evt: MouseEvent) => { if(confirm('Voulez-vous supprimer cette option ?')){ - var options = JSON.parse(JSON.stringify(state.section.options)) + const options = JSON.parse(JSON.stringify(state.section.options)) options.splice(id, 1); setState(state => ({ ...state, changed: true, section: { ...state.section, options }})); }