StarterHive icon indicating copy to clipboard operation
StarterHive copied to clipboard

⭐FEAT: Make the issues list dynamic

Open ThGnommy opened this issue 1 year ago • 2 comments

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);
  }
};

ThGnommy avatar Jun 12 '23 12:06 ThGnommy

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

welcome[bot] avatar Jun 12 '23 12:06 welcome[bot]

@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.

ArslanYM avatar Jun 12 '23 14:06 ArslanYM