diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-16 18:16:09 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-16 18:16:09 +0100 |
| commit | dcd2a7ab382fece8e0ae2979aad4a180b6a105e1 (patch) | |
| tree | 0e58f8a5b4977eb0c9ff9759484ecded72bd7e38 /src/utils/hooks/use-comments.tsx | |
| parent | 4bdbca861293357bb7928c6c7a5990be9f37380b (diff) | |
build(components, hooks): fix type errors introduced by deps upgrade
Since #7e37f2b Typescript was complaining about some types.
Diffstat (limited to 'src/utils/hooks/use-comments.tsx')
| -rw-r--r-- | src/utils/hooks/use-comments.tsx | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/utils/hooks/use-comments.tsx b/src/utils/hooks/use-comments.tsx deleted file mode 100644 index 6ac3d42..0000000 --- a/src/utils/hooks/use-comments.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import useSWR from 'swr'; -import { getAllComments } from '../../services/graphql'; -import { SingleComment } from '../../types'; - -export type UseCommentsConfig = { - contentId?: string | number; - fallback?: SingleComment[]; -}; - -/** - * Retrieve the comments of a page/article. - * - * @param {string | number} contentId - A page/article id. - * @returns {SingleComment[]|undefined} - */ -export const useComments = ({ - contentId, - fallback, -}: UseCommentsConfig): SingleComment[] | undefined => { - const { data } = useSWR(contentId ? { contentId } : null, getAllComments); - - return data ?? fallback; -}; |
