pull/5370/head
yann300 7 months ago
parent 5eec2f005c
commit 47a5d97872
  1. 30
      libs/remix-url-resolver/src/github-folder-resolver.ts

@ -17,20 +17,20 @@ export const githubFolderResolver = async (url, obj = {}, token) => {
}
const pullFolder = async (url, token) => {
url = new URL(url);
const pathname = url.pathname;
const pathParts = pathname.split('/');
const username = pathParts[1];
const repo = pathParts[2];
const folderPath = pathParts.slice(5).join('/');
const apiUrl = `https://api.github.com/repos/${username}/${repo}/contents/${folderPath}`;
const response = await axios.get(apiUrl,
{
headers: {
Authorization: `Bearer ${token}`
}
});
const data = await response.data;
return data
url = new URL(url);
const pathname = url.pathname;
const pathParts = pathname.split('/');
const username = pathParts[1];
const repo = pathParts[2];
const folderPath = pathParts.slice(5).join('/');
const apiUrl = `https://api.github.com/repos/${username}/${repo}/contents/${folderPath}`;
const response = await axios.get(apiUrl,
{
headers: {
Authorization: `Bearer ${token}`
}
});
const data = await response.data;
return data
}

Loading…
Cancel
Save