Merge pull request #39 from Y4ELX/fix-infinite-loading-missing-resources

fix: handle not found errors for Mii and User in API responses
This commit is contained in:
trafficlunar 2026-04-19 21:58:14 +01:00 committed by GitHub
commit 7f87a42b11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 0 deletions

View file

@ -34,5 +34,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
}, },
}); });
if (!mii) return NextResponse.json({ error: "Mii not found" }, { status: 404 });
return NextResponse.json(mii); return NextResponse.json(mii);
} }

View file

@ -21,5 +21,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
}, },
}); });
if (!user) return NextResponse.json({ error: "User not found" }, { status: 404 });
return NextResponse.json(user); return NextResponse.json(user);
} }

View file

@ -31,6 +31,8 @@ export default function MiiPage() {
return res.json(); return res.json();
}) })
.then((data) => { .then((data) => {
if (!data) throw new Error("Mii not found");
setMii(data); setMii(data);
setLoading(false); setLoading(false);

View file

@ -28,6 +28,8 @@ export default function ProfileLayout() {
return res.json(); return res.json();
}) })
.then((data) => { .then((data) => {
if (!data) throw new Error("Profile not found");
setUser(data); setUser(data);
setLoading(false); setLoading(false);
}) })