1nwf / Produx-v2

Use shorthand property syntax for object literals JS-0240
Anti-pattern
Minor
8 months ago2 years old
 6import AccessPrivateProduct from "./AccessPrivateProduct";
 7export default function SearchProducts({ name }: { name: string }) {
 8  const { data, isLoading, error } = useGetProductsQuery({
 9    name: name,10    page: 1,
11  });
12  const { products } = data ? (data as ProductResponse) : { products: [] };
19    const [{ isDragging }, drag] = useDrag(() => ({
20        type: 'post',
21        item: {
22            post: post,23        },
24        collect: (monitor) => ({
25            isDragging: !!monitor.isDragging(),
 40                if (entries[0].isIntersecting && hasMore) {
 41                    await getComments({
 42                        postId: parseInt(postId as string),
 43                        lastId: lastId, 44                    })
 45                }
 46            })
 25                    pathname: pathToPost,
 26                    query: {
 27                        name: data.product.name || (name as string),
 28                        channel: channel, 29                        postId: data.ID,
 30                    },
 31                })
 47    useEffect(() => {
 48        setPosts([])
 49        getPosts({
 50            productId: productId, 51            channel: (channel as string).toLowerCase(),
 52        })
 53    }, [channel])