ArslanYM / StarterHive

🚀✨ Help beginners to contribute to open source projects of remotely hiring organizations.
https://starter-hive.vercel.app/
MIT License
205 stars 198 forks source link

⭐FEAT: Make the issues list dynamic #242

Open ThGnommy opened 1 year ago

ThGnommy commented 1 year ago

Would be nice to have a dynamic issues list.

image

We can use the Octokit API to handle all the requests for the issues. I think since this will be a major change for the project is better to have a discussion first, I have already start working on this.

This is a code example for the API request using octokit, with pagination.

const octokit = new Octokit({
  auth: import.meta.env.VITE_GITHUB_TOKEN,
});

export const getRepoInfo = async () => {
  try {
    const parameters = {
      owner: "ArslanYM",
      repo: "StarterHive",
      sort: "updated",
      direction: "asc",
      per_page: 6,
    };

    const issuesPages = [];

    for await (const response of octokit.paginate.iterator(
      "GET /repos/{owner}/{repo}/issues",
      parameters
    )) {
      const issues = response.data;
      issuesPages.push(issues);
    }
    // This function returns an array that contains different arrays with a max of 6 issue objects. 
    // This way we can handle the pagination easily.
    return issuesPages;
  } catch (error) {
    throw new Error(error);
  }
};
welcome[bot] commented 1 year ago

💖Thanks for opening your first issue here! Be sure to star ⭐ the repo !💖

ArslanYM commented 1 year ago

@ThGnommy Actually we will be soon working on this, The Find Issues section is supposed to show issues in projects or codebases of organizations that are actual companies. And can potentially hire people.