Skip to content

Commit

Permalink
chore: add back profile fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-stumpf committed Jul 29, 2024
1 parent 0d67bd0 commit 44d4b54
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ const nextConfig = {
{
hostname: "og.link3.to",
},
{
hostname: "imagedelivery.net"
}
],
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
Expand Down
43 changes: 23 additions & 20 deletions src/app/(marketing)/profile/[username]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,30 @@ const LevelPolygon = () => {
}

async function getProfileData(username: string) {
// const req = `https://api.guild.xyz/v2/profiles/${username}`
// const res = await fetch(req)
// if (!res.ok) {
// throw new Error("Failed to fetch profile data")
// }
// return res.json() as Promise<Profile>
//
// mocking for the time being
const res = {
id: 4,
userId: 6027190,
username: "durumm",
name: "durum",
bio: null,
profileImageUrl:
"https://guild-xyz.mypinata.cloud/ipfs/QmWGdo6FkjSz22oDZFMJysx3hGKoVqtzTWVMx9tTSP7jvi",
backgroundImageUrl: null,
createdAt: "2024-07-25T10:04:20.781Z",
updatedAt: "2024-07-25T10:04:20.781Z",
const req = `https://api.guild.xyz/v2/profiles/${username}`
try {
const res = await fetch(req)
if (!res.ok) {
throw new Error("Failed to fetch profile data")
}
return res.json() as Promise<Profile>
} catch (e) {
// mocking for the time being if fetch fails
console.error(e)
const res = {
id: 4,
userId: 6027190,
username: "durumm",
name: "durum",
bio: null,
profileImageUrl:
"https://guild-xyz.mypinata.cloud/ipfs/QmWGdo6FkjSz22oDZFMJysx3hGKoVqtzTWVMx9tTSP7jvi",
backgroundImageUrl: null,
createdAt: "2024-07-25T10:04:20.781Z",
updatedAt: "2024-07-25T10:04:20.781Z",
}
return res
}
return res
}

// TODO: try get this from the backend if not possible write zod validation
Expand Down

0 comments on commit 44d4b54

Please sign in to comment.