From 8bc96269450d3a02df53c77b02dbfb0a0bb61b7b Mon Sep 17 00:00:00 2001 From: Asgeir Date: Mon, 15 Jan 2024 16:23:29 +0100 Subject: [PATCH] Remove properties from snapshot response that are not really part of the snapshot space config --- packages/app/src/services/snapshot.ts | 6 +++++- packages/backend/lib/snapshot.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/app/src/services/snapshot.ts b/packages/app/src/services/snapshot.ts index ba0e802a..c5ba70de 100644 --- a/packages/app/src/services/snapshot.ts +++ b/packages/app/src/services/snapshot.ts @@ -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 } diff --git a/packages/backend/lib/snapshot.ts b/packages/backend/lib/snapshot.ts index 8882107b..d279bfe3 100644 --- a/packages/backend/lib/snapshot.ts +++ b/packages/backend/lib/snapshot.ts @@ -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 }