fix: reduce share errors
This commit is contained in:
@@ -19,9 +19,14 @@ interface OverviewShareProps {
|
|||||||
export function OverviewShare({ projectId }: OverviewShareProps) {
|
export function OverviewShare({ projectId }: OverviewShareProps) {
|
||||||
const trpc = useTRPC();
|
const trpc = useTRPC();
|
||||||
const query = useQuery(
|
const query = useQuery(
|
||||||
trpc.share.overview.queryOptions({
|
trpc.share.overview.queryOptions(
|
||||||
projectId,
|
{
|
||||||
}),
|
projectId,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
retry: 0,
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
const data = query.data;
|
const data = query.data;
|
||||||
const mutation = useMutation(
|
const mutation = useMutation(
|
||||||
|
|||||||
@@ -48,7 +48,12 @@ export const shareRouter = createTRPCRouter({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!share) {
|
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 {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user