Skip to content

Commit

Permalink
Merge pull request #705 from RadhikaMalpani1702/main
Browse files Browse the repository at this point in the history
Fixed the Bug in Contributors Data Fetching in Contributors Page
  • Loading branch information
MastanSayyad authored Aug 7, 2024
2 parents cfef8f1 + e5db566 commit c8a3847
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Components/Signup/Signup.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Space above and below the form */
box-sizing: border-box;
/* Include padding in element's total width/height */
background-color: #f0f0f0;

/* Optional: Background color to visualize the container */
}

Expand Down
19 changes: 16 additions & 3 deletions src/Pages/Contributors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,25 @@ function Contributors() {
const [contributors, setContributors] = useState([]);

useEffect(() => {
async function fetchContributors() {
async function fetchContributors(page = 1, allContributors = []) {
try {
const response = await axios.get(
'https://api.github.com/repos/Priyaaa1/StartConnect-Hub/contributors'
`https://api.github.com/repos/Priyaaa1/StartConnect-Hub/contributors`,
{
params: {
per_page: 100,
page,
},
}
);
setContributors(response.data);

const newContributors = response.data;
if (newContributors.length > 0) {

fetchContributors(page + 1, [...allContributors, ...newContributors]);
} else {
setContributors(allContributors);
}
} catch (error) {
console.error('Error in fetching contributors:', error);
}
Expand Down

0 comments on commit c8a3847

Please sign in to comment.