Use new schema arg
This commit is contained in:
parent
7be8218f0c
commit
f4d2f42c01
2 changed files with 2 additions and 16 deletions
|
@ -12,7 +12,7 @@ function usePopularGroups() {
|
||||||
[Entities.POPULAR_GROUPS, ''],
|
[Entities.POPULAR_GROUPS, ''],
|
||||||
'/api/mock/groups', // '/api/v1/truth/trends/groups'
|
'/api/mock/groups', // '/api/v1/truth/trends/groups'
|
||||||
{
|
{
|
||||||
parser: parseGroup,
|
schema: groupSchema,
|
||||||
enabled: features.groupsDiscovery,
|
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 };
|
export { usePopularGroups };
|
|
@ -12,7 +12,7 @@ function useSuggestedGroups() {
|
||||||
[Entities.POPULAR_GROUPS, ''],
|
[Entities.POPULAR_GROUPS, ''],
|
||||||
'/api/mock/groups', // '/api/v1/truth/suggestions/groups'
|
'/api/mock/groups', // '/api/v1/truth/suggestions/groups'
|
||||||
{
|
{
|
||||||
parser: parseGroup,
|
schema: groupSchema,
|
||||||
enabled: features.groupsDiscovery,
|
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 };
|
export { useSuggestedGroups };
|
Loading…
Reference in a new issue