generated from shuding/nextra-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from sei-protocol/fix/ecosystem-api-endpoint
Fixed ecosystem API endpoint
- Loading branch information
Showing
1 changed file
with
38 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [] }; | ||
} | ||
} |