Skip to content
Snippets Groups Projects

Notifications + small updates

Merged H9031 requested to merge notification-view into development
9 files
+ 147
77
Compare changes
  • Side-by-side
  • Inline
Files
9
+ 31
0
@@ -66,6 +66,37 @@ export default class GameView extends React.Component {
@@ -66,6 +66,37 @@ export default class GameView extends React.Component {
});
});
}
}
 
handleLeaveFaction = e => {
 
let token = sessionStorage.getItem("token");
 
let error = false;
 
fetch(
 
`${process.env.REACT_APP_API_URL}/faction/leave/${
 
this.state.gameInfo.id
 
}`,
 
{
 
method: "DELETE",
 
headers: {
 
Authorization: "Bearer " + token
 
}
 
}
 
)
 
.then(res => {
 
if (!res.ok) {
 
throw Error();
 
} else {
 
return res.json();
 
}
 
})
 
.then(res => {
 
alert(res.message);
 
this.getPlayerRole(this.state.gameInfo.id);
 
})
 
.catch(error => {
 
alert("Game not found");
 
window.document.location.href = "/";
 
});
 
};
 
handleLeaveFaction = e => {
handleLeaveFaction = e => {
if (window.confirm("Are you sure you want to leave your faction?")) {
if (window.confirm("Are you sure you want to leave your faction?")) {
let token = sessionStorage.getItem("token");
let token = sessionStorage.getItem("token");
Loading