fix: reduce share errors
This commit is contained in:
@@ -19,9 +19,14 @@ interface OverviewShareProps {
|
||||
export function OverviewShare({ projectId }: OverviewShareProps) {
|
||||
const trpc = useTRPC();
|
||||
const query = useQuery(
|
||||
trpc.share.overview.queryOptions({
|
||||
projectId,
|
||||
}),
|
||||
trpc.share.overview.queryOptions(
|
||||
{
|
||||
projectId,
|
||||
},
|
||||
{
|
||||
retry: 0,
|
||||
},
|
||||
),
|
||||
);
|
||||
const data = query.data;
|
||||
const mutation = useMutation(
|
||||
|
||||
@@ -48,7 +48,12 @@ export const shareRouter = createTRPCRouter({
|
||||
});
|
||||
|
||||
if (!share) {
|
||||
throw TRPCNotFoundError('Share not found');
|
||||
// Throw error if shareId is provided, otherwise return null
|
||||
if ('shareId' in input) {
|
||||
throw TRPCNotFoundError('Share not found');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user