From 45e8f2ba02db6c26717a58799b0244526ed106af Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Wed, 6 Mar 2024 15:02:32 +0300 Subject: [PATCH] Refactor Comment component and improve debug logging Implemented a delete function in the Comment component that filters out the selected comment in real time, enhancing the user experience by providing immediate feedback upon deletion. Also, refactor the authorFollows function in the GraphQL client core to use standardized string quotations for better code consistency. --- src/components/Article/Comment/Comment.tsx | 2 -- src/components/Views/Author/Author.tsx | 6 +++--- src/graphql/client/core.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/Article/Comment/Comment.tsx b/src/components/Article/Comment/Comment.tsx index 316f0fa2..a0fee501 100644 --- a/src/components/Article/Comment/Comment.tsx +++ b/src/components/Article/Comment/Comment.tsx @@ -71,8 +71,6 @@ export const Comment = (props: Props) => { } await showSnackbar({ body: t('Comment successfully deleted') }) } - - } catch (error) { console.error('[deleteReaction]', error) } diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index b519ca28..ad9f5f66 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -139,7 +139,7 @@ export const AuthorView = (props: Props) => { ) const description = createMemo(() => getDescription(author()?.bio)) const handleDeleteComment = (id: number) => { - setCommented((prev) => prev.filter((comment) => comment.id !== id)); + setCommented((prev) => prev.filter((comment) => comment.id !== id)) } return ( @@ -235,14 +235,14 @@ export const AuthorView = (props: Props) => {
diff --git a/src/graphql/client/core.ts b/src/graphql/client/core.ts index b46cdc27..bfc0e03f 100644 --- a/src/graphql/client/core.ts +++ b/src/graphql/client/core.ts @@ -135,7 +135,7 @@ export const apiClient = { user?: string }): Promise => { const response = await publicGraphQLClient.query(authorFollows, params).toPromise() - console.log("!!! response:", response); + console.log('!!! response:', response) return response.data.get_author_follows },