Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ecosystem API endpoint #101

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: [] };
}
}
Loading