Skip to content

Commit

Permalink
close wizard after action, addlight "preventDefault" error
Browse files Browse the repository at this point in the history
  • Loading branch information
hendriksen-mark committed Jun 10, 2024
1 parent 8bf1755 commit 6297c58
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/Pages/Bridge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const Bridge = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});
closeWizard()
};

const backupConfig = () => {
Expand All @@ -165,6 +166,7 @@ const Bridge = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});
closeWizard()
};

const downloadConfig = () => {
Expand All @@ -178,6 +180,7 @@ const Bridge = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});
closeWizard()
};

const Restart = () => {
Expand Down Expand Up @@ -270,6 +273,7 @@ const Bridge = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});
closeWizard()
};

const restoreAlert = () => {
Expand Down Expand Up @@ -299,6 +303,7 @@ const Bridge = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});
closeWizard()
};

const debugOptions = () => {
Expand Down Expand Up @@ -340,6 +345,7 @@ const Bridge = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});
closeWizard()
};

const downloadLog = () => {
Expand All @@ -353,6 +359,8 @@ const Bridge = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});

closeWizard()
};

let options = timezones.map(function (timezone) {
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Lights.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function Lights({ HOST_IP, API_KEY }) {
closeWizard={closeWizard}
headline="Add Light"
>
<AddLight HOST_IP={HOST_IP} API_KEY={API_KEY}></AddLight>
<AddLight HOST_IP={HOST_IP} API_KEY={API_KEY} closeWizard={closeWizard}></AddLight>
</Wizard>
</div>
);
Expand Down
7 changes: 3 additions & 4 deletions src/components/AddLight/AddLight.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import GenericButton from "../GenericButton/GenericButton";
import GenericText from "../GenericText/GenericText";
import SelectMenu from "../SelectMenu/SelectMenu";

const AddLight = ({ HOST_IP, API_KEY }) => {
const AddLight = ({ HOST_IP, API_KEY, closeWizard }) => {
const [lightData, setLightData] = useState({
protocol: "auto",
});
Expand All @@ -19,8 +19,7 @@ const AddLight = ({ HOST_IP, API_KEY }) => {
});
};

const handleForm = (evt) => {
evt.preventDefault();
const handleForm = () => {
const { protocol: lightproto, ip: lightip, ...rest } = lightData;
const formattedData = {
protocol: lightproto,
Expand All @@ -36,7 +35,7 @@ const AddLight = ({ HOST_IP, API_KEY }) => {
console.error(error);
toast.error(`Error occurred: ${error.message}`);
});

closeWizard()
};

const protocols = [
Expand Down
1 change: 1 addition & 0 deletions src/components/NotificationCenter/NotificationCenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const NotificationCenter = ({HOST_IP, API_KEY, updating, notifications }) => {
toast.error(`Error occurred: ${error.message}`);
});
}
closeWizard()
};

const getValueState = (state) => {
Expand Down

0 comments on commit 6297c58

Please sign in to comment.