mirror of
https://github.com/yude-jp/yude.jp
synced 2025-06-24 05:42:41 +09:00
Add error handling, Update message format
This commit is contained in:
parent
cd93e4691d
commit
e7643e30a8
@ -9,7 +9,7 @@ function App ({data}){
|
|||||||
const { t, lang } = useTranslation("common")
|
const { t, lang } = useTranslation("common")
|
||||||
|
|
||||||
if (data === undefined){
|
if (data === undefined){
|
||||||
console.log("Discord API: データの取得に失敗しました。 / Failed to retrieve data.")
|
console.log("[Discord API] データの取得に失敗しました。 / Failed to retrieve data.")
|
||||||
return <p></p>
|
return <p></p>
|
||||||
}else{
|
}else{
|
||||||
const str = JSON.stringify(data)
|
const str = JSON.stringify(data)
|
||||||
|
@ -8,7 +8,10 @@ const App = () => {
|
|||||||
.then((r) => r.json())
|
.then((r) => r.json())
|
||||||
.then((j) => setStatus(j.members[0].status))
|
.then((j) => setStatus(j.members[0].status))
|
||||||
}, []);
|
}, []);
|
||||||
|
if (status === undefined){
|
||||||
|
console.log("[Discord API] オンライン状態を取得できませんでした。 / Failed to retrieve online status.")
|
||||||
|
return <div></div>
|
||||||
|
}else{
|
||||||
if (status === "online") {
|
if (status === "online") {
|
||||||
return <div className="font-bold text-gray-700 rounded-full bg-green-500 flex w-5 h-5 items-center justify-center"></div>
|
return <div className="font-bold text-gray-700 rounded-full bg-green-500 flex w-5 h-5 items-center justify-center"></div>
|
||||||
}else{
|
}else{
|
||||||
@ -23,5 +26,6 @@ const App = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
@ -9,7 +9,7 @@ function App ({data}) {
|
|||||||
const { t, lang } = useTranslation("common")
|
const { t, lang } = useTranslation("common")
|
||||||
|
|
||||||
if (data === undefined){
|
if (data === undefined){
|
||||||
console.log("Spotify Web API: データの取得に失敗しました。 / Failed to retrieve data.")
|
console.log("[Spotify Web API] データの取得に失敗しました。 / Failed to retrieve data.")
|
||||||
return <p></p>
|
return <p></p>
|
||||||
}else{
|
}else{
|
||||||
if (data.isPlaying === "true"){
|
if (data.isPlaying === "true"){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user