Skip to content

Commit

Permalink
Merge pull request #101 from sei-protocol/fix/ecosystem-api-endpoint
Browse files Browse the repository at this point in the history
Fixed ecosystem API endpoint
  • Loading branch information
codebycarson authored Jul 5, 2024
2 parents 3b0b34d + 5d3be1c commit 3959e58
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions data/ecosystemData.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
export type EcosystemAppLogoType = {
fileId: string;
url: string;
alt: string | null;
fileId: string;
url: string;
alt: string | null;
};

export type EcosystemFieldData = {
"featured-app": boolean;
profile: string;
link: string;
"sei-only": boolean;
name: string;
slug: string;
logo: EcosystemAppLogoType;
categorie: string;
'featured-app': boolean;
profile: string;
link: string;
'sei-only': boolean;
name: string;
slug: string;
logo: EcosystemAppLogoType;
categorie: string;
};

export type EcosystemItem = {
id: string;
cmsLocaleId: string;
lastPublished: string;
lastUpdated: string;
createdOn: string;
isArchived: boolean;
isDraft: boolean;
fieldData: EcosystemFieldData;
id: string;
cmsLocaleId: string;
lastPublished: string;
lastUpdated: string;
createdOn: string;
isArchived: boolean;
isDraft: boolean;
fieldData: EcosystemFieldData;
};

export type EcosystemResponse = {
data: EcosystemItem[];
data: EcosystemItem[];
};

export async function getSeiEcosystemAppsData(): Promise<EcosystemResponse> {
const url = "http://staging.app-api.seinetwork.io/webflow/ecosystem"; // TODO: Move to ENV
const headers = { Accept: 'application/json' };
const url = 'http://app-api.seinetwork.io/webflow/ecosystem'; // TODO: Move to ENV
const headers = { Accept: 'application/json' };

try {
const response = await fetch(url, {
method: "GET",
headers,
});
try {
const response = await fetch(url, {
method: 'GET',
headers
});

if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

const data = await response.json();
console.log("Sei Ecosystem data", data);
return data;
} catch (error) {
console.error("Failed to fetch data:", error);
return { data: [] };
}
}
const data = await response.json();
console.log('Sei Ecosystem data', data);
return data;
} catch (error) {
console.error('Failed to fetch data:', error);
return { data: [] };
}
}

0 comments on commit 3959e58

Please sign in to comment.