Skip to content

Commit 63a686a

Browse files
committed
fix(sonar): update code to fix sonar issues
1 parent b5a46a3 commit 63a686a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/api/auth/use-login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ const login = async (variables: Variables) => {
3232
return data;
3333
};
3434

35-
export const useLogin = createMutation<Response, Variables, Error>({
35+
export const useLogin = createMutation<Response, Variables>({
3636
mutationFn: (variables) => login(variables),
3737
});

src/api/posts/use-post-comments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ import { client } from '../common';
66
import { type Comment } from './types';
77

88
type Variables = {
9-
id: number;
9+
id?: number;
1010
};
1111

1212
type Response = {
1313
comments: Comment[];
1414
};
1515

16-
const getPostComments = async (id: number) => {
16+
const getPostComments = async (id?: number) => {
1717
const { data } = await client.get(`posts/${id}/comments`);
1818
return data;
1919
};
2020

2121
export const usePostComments = createQuery<Response, Variables>({
2222
...queryFactory.posts.detail(1)._ctx.comments,
23-
fetcher: (variables) => getPostComments(variables.id),
23+
fetcher: (variables) => getPostComments(variables?.id),
2424
});

src/app/feed/[id].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function Post() {
1515
data: { comments } = { comments: [] },
1616
isLoading: isLoadingComments,
1717
} = usePostComments({
18-
variables: { id: data?.id! },
18+
variables: { id: data?.id },
1919
});
2020

2121
if (isPending) {

src/components/cart-item/cart-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const ProductRow = ({ product }: { product: Product }) => (
5252
<Image
5353
source={{ uri: product.thumbnail }}
5454
className="h-16 w-16 rounded"
55-
resizeMode="cover"
55+
contentFit="cover"
5656
/>
5757
<View className="ml-4 flex-1">
5858
<Text className="font-medium">{product.title}</Text>

0 commit comments

Comments
 (0)