save board model to localstorage
This commit is contained in:
parent
e00617ac78
commit
6fcaff9cc3
@ -3,6 +3,7 @@ import {
|
||||
} from "./types";
|
||||
|
||||
export const setBoard = (board) => (dispatch) => {
|
||||
window.localStorage.setItem("board", board);
|
||||
dispatch({
|
||||
type: BOARD,
|
||||
payload: board,
|
||||
|
@ -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,
|
||||
|
@ -4,7 +4,7 @@ const initialValue = () => {
|
||||
if (window.localStorage.getItem("board")) {
|
||||
return window.localStorage.getItem("board");
|
||||
}
|
||||
return "bla";
|
||||
return null;
|
||||
};
|
||||
|
||||
const initialState = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user