Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/notifications display #1133

Merged
merged 3 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const CommentsDrawer = ({
{commentsData && commentsData.length > 0 ? (
commentsData.map((comment) => (
<CommentItem
commenterName={comment.email}
commenterName={comment.user}
commentTime={comment.createdAt}
isNew={comment.isNew}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {
import { useEffect } from "react"
import { useForm } from "react-hook-form"
import { BiSend } from "react-icons/bi"
import { useQueryClient } from "react-query"

import { COMMENTS_KEY } from "constants/queryKeys"

import { useUpdateComments } from "hooks/commentsHooks"

Expand All @@ -28,6 +31,7 @@ export const SendCommentForm = ({
formState,
setError,
clearErrors,
resetField,
} = useForm<CommentFormProps>({
mode: "onBlur",
})
Expand All @@ -37,8 +41,12 @@ export const SendCommentForm = ({
error: updateNotificationsError,
} = useUpdateComments()

const queryClient = useQueryClient()

const handleUpdateNotifications = async ({ comment }: CommentFormProps) => {
await updateNotifications({ siteName, requestId, message: comment })
resetField("comment")
queryClient.invalidateQueries([COMMENTS_KEY, siteName])
}

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export type UpdateCommentProps = CommentProps & {
export interface CommentData {
message: string
createdAt: number
email: string
user: string
isNew: boolean
}