Skip to content

Commit

Permalink
Remove properties from snapshot response that are not really part of …
Browse files Browse the repository at this point in the history
…the snapshot space config
  • Loading branch information
asgeir-s committed Jan 15, 2024
1 parent 97e2bcf commit 8bc9626
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/app/src/services/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export const getSnapshotSpaceSettings = async (ensName: string, chainId: number)
const res = await fetch(`${getHubUrl(chainId)}/api/spaces/${ensName}`)
if (res.ok) {
try {
return await res.json()
return await res.json().then((res) => {
// Remove flagged, verified, hibernated, and turbo properties from res, as they are not part of the space config, but rater extra info from the server.
const { flagged, verified, hibernated, turbo, ...filteredRes } = res
return filteredRes
})
} catch (error) {
return undefined // there is not snapshot space for this ENS
}
Expand Down
6 changes: 5 additions & 1 deletion packages/backend/lib/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export const getSnapshotSpaceSettings = async (ensName: string, chainId: number)
const res = await fetch(`${getHubUrl(chainId)}/api/spaces/${ensName}`)
if (res.ok) {
try {
return await res.json()
return await res.json().then((res) => {
// Remove flagged, verified, hibernated, and turbo properties from res, as they are not part of the space config, but rater extra info from the server.
const { flagged, verified, hibernated, turbo, ...filteredRes } = res
return filteredRes
})
} catch (error) {
return undefined // there is not snapshot space for this ENS
}
Expand Down

0 comments on commit 8bc9626

Please sign in to comment.