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

Fix title during page loading

This commit is contained in:
yude 2021-09-26 13:24:10 +09:00
parent 2b6ca4354d
commit 5276456ac2
Signed by: yude
GPG Key ID: EB0FE5D925C4A968

View File

@ -1,4 +1,4 @@
// Base layout // Base layout
import Layout from "../../components/Layout" import Layout from "../../components/Layout"
// React // React
@ -15,10 +15,9 @@ export default function UUID() {
const router = useRouter() const router = useRouter()
const { uuid } = router.query const { uuid } = router.query
const { data, error } = useSwr( const { data, error } = useSwr(
router.query.id ? `/api/user/${router.query.id}` : null, uuid ? `/api/PlayerName/${uuid}` : null,
fetcher fetcher
) )
if (error) { if (error) {
return ( return (
<> <>
@ -27,23 +26,23 @@ export default function UUID() {
</Layout> </Layout>
</> </>
) )
} else {
if (!data) {
return (
<>
<Layout title="読み込み中... - プレイヤー情報">
<Players uuid={uuid} />
</Layout>
</>
)
} else {
return (
<>
<Layout title={data.username + " - " + "プレイヤー情報"}>
<Players uuid={uuid} />
</Layout>
</>
)
}
} }
if (!data) {
return (
<>
<Layout title="読み込み中... - プレイヤー情報">
<Players uuid={uuid} />
</Layout>
</>
)
}
return (
<>
<Layout title={<PlayerName uuid={uuid.uuid} /> + " - " + "プレイヤー情報"}>
<Players uuid={uuid} />
</Layout>
</>
)
} }