website refactor
This commit is contained in:
@@ -13,7 +13,14 @@ export function useCapability(
|
||||
|
||||
const queryResult = useQuery({
|
||||
queryKey: ['policySnapshot', capabilityKey],
|
||||
queryFn: () => policyService.getSnapshot(),
|
||||
queryFn: async () => {
|
||||
const result = await policyService.getSnapshot();
|
||||
if (result.isErr()) {
|
||||
const error = result.getError();
|
||||
throw new ApiError(error.message, 'SERVER_ERROR', { timestamp: new Date().toISOString() });
|
||||
}
|
||||
return result.unwrap();
|
||||
},
|
||||
staleTime: 60_000,
|
||||
gcTime: 5 * 60_000,
|
||||
...options,
|
||||
@@ -32,4 +39,4 @@ export function useCapability(
|
||||
isCapabilityEnabled: capabilityState === 'enabled',
|
||||
isCapabilityComingSoon: capabilityState === 'coming_soon',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user