Fix game status check.
This commit is contained in:
parent
04bcea5a31
commit
5fe50101d8
|
|
@ -1,27 +1,53 @@
|
||||||
// © XlXi 2021
|
// © XlXi 2021
|
||||||
// Graphictoria 5
|
// Graphictoria 5
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link, useHistory } from "react-router-dom";
|
||||||
|
|
||||||
|
import Config from '../config.js';
|
||||||
|
|
||||||
import SetTitle from "../Helpers/Title.js";
|
import SetTitle from "../Helpers/Title.js";
|
||||||
|
|
||||||
import { GenericErrorModal } from './Errors.js';
|
import { GenericErrorModal } from './Errors.js';
|
||||||
|
|
||||||
|
var url = Config.BaseUrl.replace('http://', '');
|
||||||
|
var protocol = Config.Protocol;
|
||||||
|
|
||||||
class Games extends React.Component {
|
class Games extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {offline: false};
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount()
|
componentDidMount()
|
||||||
{
|
{
|
||||||
|
var app = this;
|
||||||
|
|
||||||
SetTitle("Games");
|
SetTitle("Games");
|
||||||
|
|
||||||
|
function updateBanners()
|
||||||
|
{
|
||||||
|
axios.get(protocol + 'api.' + url + '/web/games/status').then((response) => {
|
||||||
|
app.setState({offline: !response.data.available});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
updateBanners();
|
||||||
}
|
}
|
||||||
|
|
||||||
render()
|
render()
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
|
this.state.offline
|
||||||
|
?
|
||||||
<GenericErrorModal title="Games Offline">
|
<GenericErrorModal title="Games Offline">
|
||||||
<img src="/images/symbols/warning.png" width="100" className="mb-3" />
|
<img src="/images/symbols/warning.png" width="100" className="mb-3" />
|
||||||
<br />
|
<br />
|
||||||
Seems like XlXi tripped over the game server's power cord again. Games are temporarily unavailable and administrators have been notified of the issue. Sorry for the inconvenience!
|
Seems like XlXi tripped over the game server's power cord again. Games are temporarily unavailable and administrators have been notified of the issue. Sorry for the inconvenience!
|
||||||
</GenericErrorModal>
|
</GenericErrorModal>
|
||||||
|
:
|
||||||
|
<></>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue