Skip to content
Draft
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
12 changes: 9 additions & 3 deletions Frontend/src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,21 @@ export const createDiscussion = (payload) => {
}

export const likeDiscussion = (discussionId) => {
return axios.get(`${BASE}/${discussionId}/like`, { withCredentials: true });
return axios.post(`${BASE}/discussion/${discussionId}/like`, {}, {
withCredentials: true,
headers: { Authorization: `Bearer ${accessToken}` }
});
}

export const dislikeDiscussion = (discussionId) => {
return axios.get(`${BASE}/${discussionId}/dislike`, { withCredentials: true });
return axios.post(`${BASE}/discussion/${discussionId}/dislike`, {}, {
withCredentials: true,
headers: { Authorization: `Bearer ${accessToken}` }
});
}

export const createComment = (discussionId, comment) => {
return axios.post(`${BASE}/${discussionId}/comment`, comment, {
return axios.post(`${BASE}/discussion/${discussionId}/comment`, comment, {
withCredentials: true,
headers: { Authorization: `Bearer ${accessToken}` }
})
Expand Down
1 change: 1 addition & 0 deletions Frontend/src/components/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default function NewNav() {
const navItems = [
{ to: "/", label: "Home" },
{ to: "/problems", label: "Problems" },
{ to: "/discussion", label: "Discussions" },
...(userRole === "author" || userRole === "admin"
? [{ to: "/newproblem", label: "Create Problem" }]
: []),
Expand Down
Loading