0
0
mirror of https://github.com/yude-jp/yude.jp synced 2024-06-09 23:36:01 +09:00

Add error handling, Update message format

This commit is contained in:
yude 2021-05-28 11:36:45 +09:00
parent cd93e4691d
commit e7643e30a8
Signed by: yude
GPG Key ID: EB0FE5D925C4A968
3 changed files with 7 additions and 3 deletions

View File

@ -9,7 +9,7 @@ function App ({data}){
const { t, lang } = useTranslation("common")
if (data === undefined){
console.log("Discord API: データの取得に失敗しました。 / Failed to retrieve data.")
console.log("[Discord API] データの取得に失敗しました。 / Failed to retrieve data.")
return <p></p>
}else{
const str = JSON.stringify(data)

View File

@ -8,7 +8,10 @@ const App = () => {
.then((r) => r.json())
.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") {
return <div className="font-bold text-gray-700 rounded-full bg-green-500 flex w-5 h-5 items-center justify-center"></div>
}else{
@ -23,5 +26,6 @@ const App = () => {
}
}
};
}
export default App;

View File

@ -9,7 +9,7 @@ function App ({data}) {
const { t, lang } = useTranslation("common")
if (data === undefined){
console.log("Spotify Web API: データの取得に失敗しました。 / Failed to retrieve data.")
console.log("[Spotify Web API] データの取得に失敗しました。 / Failed to retrieve data.")
return <p></p>
}else{
if (data.isPlaying === "true"){