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 comments api call #718

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions packages/api/src/postComment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiRequest, PostCommentRequest, PostCommentResponse } from './types';

export async function postComment({
questionOptionId,
optionId,
value,
serverUrl,
}: ApiRequest<PostCommentRequest>): Promise<PostCommentResponse | null> {
Expand All @@ -12,7 +12,7 @@ export async function postComment({
headers: {
'Content-type': 'application/json',
},
body: JSON.stringify({ value, questionOptionId }),
body: JSON.stringify({ value, optionId }),
});

if (!response.ok) {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/types/Comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type Comment = {
updatedAt: Date;
userId: string | null;
value: string;
questionOptionId: string | null;
optionId: string | null;
};

export type GetCommentsRequest = {
Expand All @@ -22,7 +22,7 @@ export type GetCommentsResponse = (Comment & {

export type PostCommentRequest = {
value: string;
questionOptionId: string;
optionId: string;
};

export type DeleteCommentRequest = {
Expand Down
2 changes: 1 addition & 1 deletion packages/berlin/src/pages/Comments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function Comments() {
const handlePostComment = () => {
if (optionId && comment) {
mutateComments({
questionOptionId: optionId,
optionId: optionId,
value: comment,
serverUrl: import.meta.env.VITE_SERVER_URL,
});
Expand Down
Loading