mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-11 18:29:17 +00:00
Fix fetch URLs by removing unnecessary slashes and ensure proper return type in fetchScripts map function
This commit is contained in:
parent
337292734a
commit
2169131863
@ -6,7 +6,7 @@ export const dynamic = "force-static";
|
|||||||
|
|
||||||
const fetchCategories = async (): Promise<Category[]> => {
|
const fetchCategories = async (): Promise<Category[]> => {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://raw.githubusercontent.com/community-scripts/${basePath}/refs/heads/main/json/metadata.json`,
|
`https://raw.githubusercontent.com/community-scripts${basePath}/refs/heads/main/json/metadata.json`,
|
||||||
);
|
);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return data.categories;
|
return data.categories;
|
||||||
@ -14,11 +14,11 @@ const fetchCategories = async (): Promise<Category[]> => {
|
|||||||
|
|
||||||
const fetchScripts = async (): Promise<Script[]> => {
|
const fetchScripts = async (): Promise<Script[]> => {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://api.github.com/repos/community-scripts/${basePath}/contents/json`,
|
`https://api.github.com/repos/community-scripts${basePath}/contents/json`,
|
||||||
);
|
);
|
||||||
const files: { download_url: string }[] = await response.json();
|
const files: { download_url: string }[] = await response.json();
|
||||||
const scripts = await Promise.all(
|
const scripts = await Promise.all(
|
||||||
files.map(async (file): Promise<Script> => {
|
files.map(async (file) : Promise<Script> => {
|
||||||
const response = await fetch(file.download_url);
|
const response = await fetch(file.download_url);
|
||||||
const script = await response.json();
|
const script = await response.json();
|
||||||
return script;
|
return script;
|
||||||
|
Loading…
Reference in New Issue
Block a user