Skip to content

Commit fece837

Browse files
missing HTTP response validation in the profile fetch logic
1 parent 53f820b commit fece837

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/pages/ContributorProfile/ContributorProfile.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export default function ContributorProfile() {
2626

2727
try {
2828
const userRes = await fetch(`https://api.github.com/users/${username}`);
29+
if (!userRes.ok) {
30+
throw new Error("Failed to fetch user data.");
31+
}
2932
const userData = await userRes.json();
3033
setProfile(userData);
3134

0 commit comments

Comments
 (0)