Skip to content

Commit

Permalink
CHE-130 Updated logic to handle edit save if no forum as been selected
Browse files Browse the repository at this point in the history
  • Loading branch information
brok3turtl3 committed Jun 13, 2024
1 parent 604bf08 commit 990d79a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ const ThreadsDisplay = ({ forumId, onThreadSelect }: ThreadsDisplayProps) => {
const handleUpdateThread = async (
event: React.MouseEvent<HTMLButtonElement>,
threadId: string,
forum: string,
) => {
event.stopPropagation();
setLoading(true);
try {
console.log('handleUpdateThread HIT: ');
await axios.put(
`/api/forums/${forumId}/threads/${threadId}`,
`/api/forums/${forumId || forum}/threads/${threadId}`,
{ title: editTitle, content: editContent },
{ withCredentials: true },
);
Expand Down Expand Up @@ -134,7 +134,7 @@ const ThreadsDisplay = ({ forumId, onThreadSelect }: ThreadsDisplayProps) => {
className="w-full p-2 mb-2 rounded bg-gray-800 text-white"
/>
<button
onClick={(event) => handleUpdateThread(event, thread._id)}
onClick={(event) => handleUpdateThread(event, thread._id, thread.forum)}
className="bg-blue-500 font-bold hover:bg-blue-700 ml-2 py-1 px-2 rounded text-white"
>
Save
Expand Down

0 comments on commit 990d79a

Please sign in to comment.