Skip to content

Commit 68ae190

Browse files
authored
Merge pull request #194 from ctfguide-tech/dev
dev sync
2 parents a2dd105 + 3463b19 commit 68ae190

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/pages/challenges/[...id].jsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,17 @@ function WriteUpPage({ cache, setCache, onWriteupSelect }) {
880880

881881

882882

883-
const openModal = (writeup) => {
884-
setSelectedWriteup(writeup);
885-
setUpvotes(writeup.upvotes); // Set initial upvotes
886-
setDownvotes(writeup.downvotes); // Set initial downvotes
883+
const openModal = async (writeup) => {
884+
try {
885+
const url = `${process.env.NEXT_PUBLIC_API_URL}/writeups/fetch/${writeup.id}`;
886+
const response = await request(url, "GET", null);
887+
writeup.content = response.content;
888+
setUpvotes(response.upvotes);
889+
setDownvotes(response.downvotes);
890+
setSelectedWriteup(writeup);
891+
} catch(err) {
892+
console.log(err);
893+
}
887894
setIsModalOpen(true);
888895
};
889896

0 commit comments

Comments
 (0)