diff --git a/pages/components/DiscordPlaying.js b/pages/components/DiscordPlaying.js index ab0f78c..920cafa 100644 --- a/pages/components/DiscordPlaying.js +++ b/pages/components/DiscordPlaying.js @@ -7,27 +7,25 @@ function App (){ const router = useRouter() const { locale, locales, defaultLocale, pathname } = router const { t, lang } = useTranslation("common") - const [data, setData] = useState({ hits: [] }); + const [dataPlaying, setDataPlaying] = useState({ hits: [] }); useEffect(async () => { const result = await axios( 'https://discord.com/api/guilds/723409709306216498/widget.json', ); - setData(result.data); + setDataPlaying(result.dataPlaying); }, []); - if (data === undefined){ + if (dataPlaying === undefined){ console.log("[Discord API] データの取得に失敗しました。 / Failed to retrieve data.") return

}else{ - const str = JSON.stringify(data) + const str = JSON.stringify(dataPlaying) if (str.indexOf("game") !== -1){ - const yes_playing = t('yes_playing', {playing: data.members[0].game.name}) + const yes_playing = t('yes_playing', {playing: dataPlaying.members[0].game.name}) return

{yes_playing}

- console.log("[Discord API] Playing: " + data.members[0].game.name) }else{ return

- console.log("[Discord API] Nothing playing") } } }; diff --git a/pages/components/DiscordStatus.js b/pages/components/DiscordStatus.js index e1884b5..0519c2a 100644 --- a/pages/components/DiscordStatus.js +++ b/pages/components/DiscordStatus.js @@ -8,10 +8,7 @@ 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
- }else{ + if (status === "online") { return
}else{ @@ -26,6 +23,5 @@ const App = () => { } } }; -} export default App; \ No newline at end of file diff --git a/pages/components/Spotify.js b/pages/components/Spotify.js index 87effec..356f7ed 100644 --- a/pages/components/Spotify.js +++ b/pages/components/Spotify.js @@ -7,21 +7,21 @@ function App () { const router = useRouter() const { locale, locales, defaultLocale, pathname } = router const { t, lang } = useTranslation("common") - const [data, setData] = useState({ hits: [] }); + const [dataSpotify, setDataSpotify] = useState({ hits: [] }); useEffect(async () => { const result = await axios( '/api/Spotify', ); - setData(result.data); + setDataSpotify(result.dataSpotify); }, []); - if (data === undefined){ + if (dataSpotify === undefined){ console.log("[Spotify Web API] データの取得に失敗しました。 / Failed to retrieve data.") return

}else{ - if (data.isPlaying){ - const status = data.artist + ' / ' + data.title + if (dataSpotify.isPlaying){ + const status = dataSpotify.artist + ' / ' + dataSpotify.title const listening = t('listening', {listening: status}) return

{listening}

}else{ diff --git a/pages/profile.js b/pages/profile.js index 582fa23..19cb1a9 100644 --- a/pages/profile.js +++ b/pages/profile.js @@ -55,9 +55,11 @@ export default function About(props) { />

yude

+
+ {