Skip to content
Snippets Groups Projects
Commit 82cda752 authored by Joni Laukka's avatar Joni Laukka
Browse files

selection box where user can choose a game added to header

parent 4c125a44
No related branches found
No related tags found
4 merge requests!21Development,!15Get game creation to user-marker-database-interactions,!13Resolve "Pelinluontilomake",!11Combine gamelist and new game form
......@@ -40,24 +40,24 @@ class Header extends React.Component {
Authorization: 'Bearer ' + token
}
})
.then(res => res.json())
.then(
result => {
// if token is still valid, login user
if (result === true) {
this.setState({
username: sessionStorage.getItem('name'),
token: token
});
// logout user if token has expired / is invalid
} else {
this.handleLogout();
}
},
error => {
console.log(error);
.then(res => res.json())
.then(
result => {
// if token is still valid, login user
if (result === true) {
this.setState({
username: sessionStorage.getItem('name'),
token: token
});
// logout user if token has expired / is invalid
} else {
this.handleLogout();
}
);
},
error => {
console.log(error);
}
);
}
}
......@@ -78,6 +78,13 @@ class Header extends React.Component {
)}
{this.state.username && <button>{this.state.username}</button>}
<button onClick={this.props.handleLayerChange}>change layer</button>
<label>Zoom: </label>
<select onChange={this.props.handleZoom}>
<option value="13">13</option>
<option value="10">10</option>
<option value="5">5</option>
<option value="15">15</option>
</select>
</div>
{this.state.register && (
<RegisterForm
......@@ -93,7 +100,6 @@ class Header extends React.Component {
toggleView={this.toggleView}
/>
)}
</div>
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment