From f4d2f42c01ddf4d3c9fa165333b04e3f6c53ed3d Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Tue, 14 Mar 2023 10:11:20 -0400 Subject: [PATCH] Use new schema arg --- app/soapbox/hooks/api/usePopularGroups.ts | 9 +-------- app/soapbox/hooks/api/useSuggestedGroups.ts | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/app/soapbox/hooks/api/usePopularGroups.ts b/app/soapbox/hooks/api/usePopularGroups.ts index b4b74c7f4..e856270a5 100644 --- a/app/soapbox/hooks/api/usePopularGroups.ts +++ b/app/soapbox/hooks/api/usePopularGroups.ts @@ -12,7 +12,7 @@ function usePopularGroups() { [Entities.POPULAR_GROUPS, ''], '/api/mock/groups', // '/api/v1/truth/trends/groups' { - parser: parseGroup, + schema: groupSchema, enabled: features.groupsDiscovery, }, ); @@ -30,11 +30,4 @@ function usePopularGroups() { }; } -const parseGroup = (entity: unknown) => { - const result = groupSchema.safeParse(entity); - if (result.success) { - return result.data; - } -}; - export { usePopularGroups }; \ No newline at end of file diff --git a/app/soapbox/hooks/api/useSuggestedGroups.ts b/app/soapbox/hooks/api/useSuggestedGroups.ts index 1022a45b0..829108469 100644 --- a/app/soapbox/hooks/api/useSuggestedGroups.ts +++ b/app/soapbox/hooks/api/useSuggestedGroups.ts @@ -12,7 +12,7 @@ function useSuggestedGroups() { [Entities.POPULAR_GROUPS, ''], '/api/mock/groups', // '/api/v1/truth/suggestions/groups' { - parser: parseGroup, + schema: groupSchema, enabled: features.groupsDiscovery, }, ); @@ -30,11 +30,4 @@ function useSuggestedGroups() { }; } -const parseGroup = (entity: unknown) => { - const result = groupSchema.safeParse(entity); - if (result.success) { - return result.data; - } -}; - export { useSuggestedGroups }; \ No newline at end of file