save board model to localstorage

This commit is contained in:
fbruc03 2022-11-15 16:11:35 +01:00
parent e00617ac78
commit 6fcaff9cc3
3 changed files with 71 additions and 70 deletions

View File

@ -3,6 +3,7 @@ import {
} from "./types";
export const setBoard = (board) => (dispatch) => {
window.localStorage.setItem("board", board);
dispatch({
type: BOARD,
payload: board,

View File

@ -37,9 +37,7 @@ class DeviceSeclection extends Component {
}
toggleDialog = () => {
this.props.setBoard(this.state.selectedBoard)
};
onChange = (e) => {
@ -57,12 +55,14 @@ class DeviceSeclection extends Component {
this.setState({ selectedBoard: value })
this.props.setBoard(value)
this.setState({ open: !this.state });
};
render() {
const board = this.props.selectedBoard;
if (board) {
return null;
}
else {
return (
<Dialog
style={{ zIndex: 9999999 }}
@ -90,7 +90,6 @@ class DeviceSeclection extends Component {
</IconButton>
<p>senseBox MCU</p>
</Grid>
{/* <Grid item xs={4}>
<IconButton onClick={(e) => this.onclick(e, "esp")}>
<Avatar
@ -143,6 +142,7 @@ class DeviceSeclection extends Component {
);
}
}
}
DeviceSeclection.propTypes = {
pageVisits: PropTypes.number.isRequired,

View File

@ -4,7 +4,7 @@ const initialValue = () => {
if (window.localStorage.getItem("board")) {
return window.localStorage.getItem("board");
}
return "bla";
return null;
};
const initialState = {