0
0
mirror of https://github.com/yude-jp/yude.jp synced 2025-10-12 19:28:43 +09:00

Add "Retrieving server status..." text

This commit is contained in:
2021-05-31 09:59:14 +09:00
parent d7099acd8b
commit 62925709f8
3 changed files with 10 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ export default function Minecraft(props) {
useEffect(() => {
const fetchData = async () => {
const result = await axios(
'https://api.mcsrvstat.us/2/yude.jp',
'https://mcstatus.snowdev.com.br/api/query/v3/yude.jp',
);
setData(result.data);
};
@@ -31,16 +31,19 @@ export default function Minecraft(props) {
const playing = t('minecraft:playing', {count: player})
const no_one = t('minecraft:no_one')
const offline = t('minecraft:offline')
const loading = t('minecraft:loading')
return (
<p className="text-center">
{(() => {
if (status) {
if (status == true) {
if (player == undefined || player == 0) {
return <span>{no_one}</span>
} else {
return <span>{playing}</span>
}}else{
}}else if (status == false) {
return <span>{offline}</span>
}else {
return <span>{loading}</span>
}
})()}
</p>