Skip to content

Commit

Permalink
Merge branch '50-realizar-pruebas-unitarias' of https://github.com/Ar…
Browse files Browse the repository at this point in the history
…quisoft/wiq_es1a into 50-realizar-pruebas-unitarias
  • Loading branch information
iyanfdezz committed Apr 1, 2024
2 parents 4bedbdd + 6b8ad62 commit aa35da5
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions webapp/src/pages/Config/Config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import {
Box,
Flex,
Expand All @@ -11,12 +11,27 @@ import {
NumberInputField,
NumberInputStepper,
NumberIncrementStepper,
NumberDecrementStepper
NumberDecrementStepper,
} from "@chakra-ui/react";
import Nav from "../../components/Nav/Nav.js";
import Footer from "../../components/Footer/Footer.js";
import { useNavigate } from "react-router-dom";

const Config = () => {
useEffect(() => {
// Obtener el estado de los checkboxes desde el localStorage
const selectedThemes = JSON.parse(localStorage.getItem("selectedThemes")) || [];
const checkboxes = document.querySelectorAll('input[type="checkbox"]');

checkboxes.forEach((checkbox) => {
// Verificar si el checkbox debe estar marcado según el localStorage
if (selectedThemes.includes(checkbox.id)) {
checkbox.click();
}
});
}, []);
const navigate = useNavigate();

const [clasicoTime, setClasicoTime] = useState(
localStorage.getItem("clasicoTime") || 10
);
Expand All @@ -28,9 +43,7 @@ const Config = () => {
);

const handleConfig = () => {
const checkboxes = document.querySelectorAll(
'.topicCheckboxes input[type="checkbox"]'
);
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
const selectedThemes = [];

checkboxes.forEach((checkbox) => {
Expand All @@ -48,6 +61,7 @@ const Config = () => {
localStorage.setItem("bateriaTime", bateriaTime);

alert("Cambios realizados satisfactoriamente");
navigate("/home");
}
};

Expand Down

0 comments on commit aa35da5

Please sign in to comment.