0
0
mirror of https://github.com/yude-jp/yude.jp synced 2024-12-22 20:20:09 +09:00

Remove logging for debug, translate msgs for error handling

This commit is contained in:
yude 2021-05-30 14:11:40 +09:00
parent 557ff11a82
commit 3dd345c10f
Signed by: yude
GPG Key ID: EB0FE5D925C4A968
3 changed files with 6 additions and 6 deletions

View File

@ -3,5 +3,6 @@
"playing": "{{count}} player(s) online.", "playing": "{{count}} player(s) online.",
"no_one": "No one is playing.", "no_one": "No one is playing.",
"offline": "Server is down.", "offline": "Server is down.",
"address": "Server address" "address": "Server address",
"fail": "Failed to retrieve server status."
} }

View File

@ -3,5 +3,6 @@
"playing": "{{count}} 人がプレイしています。", "playing": "{{count}} 人がプレイしています。",
"no_one": "現在、誰もログインしていません。", "no_one": "現在、誰もログインしていません。",
"offline": "サーバーがオフラインのようです。", "offline": "サーバーがオフラインのようです。",
"address": "サーバー アドレス" "address": "サーバー アドレス",
"fail": "サーバーの状態を取得できませんでした。"
} }

View File

@ -10,7 +10,7 @@ export default function Minecraft(props) {
const [dataMinecraft, setDataMinecraft] = useState({ hits: [] }); const [dataMinecraft, setDataMinecraft] = useState({ hits: [] });
const [data, setData] = useState({ hits: [] }); const [data, setData] = useState({ hits: [] });
const fail = t('minecraft:fail')
useEffect(() => { useEffect(() => {
const fetchData = async () => { const fetchData = async () => {
const result = await axios( const result = await axios(
@ -23,12 +23,10 @@ export default function Minecraft(props) {
if (data === undefined){ if (data === undefined){
console.log("[Minecraft Query] データの取得に失敗しました。 / Failed to retrieve data.") console.log("[Minecraft Query] データの取得に失敗しました。 / Failed to retrieve data.")
console.log(data)
return ( return (
<p>Failed to retrieve data</p> <p>{fail}</p>
) )
}else{ }else{
console.log(data)
const status = data.online const status = data.online
const player = data.players && data.players.online const player = data.players && data.players.online
const playing = t('minecraft:playing', {count: player}) const playing = t('minecraft:playing', {count: player})