Skip to content

Commit ff0377f

Browse files
committed
Remove Temporary Code
1 parent 2bf6324 commit ff0377f

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

frontend/src/presentation/components/QuestionCard.tsx

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import { Question } from "../../domain/entities/Question";
66
import styles from "./QuestionCard.module.css";
77
import { getDifficultyColor } from "presentation/utils/QuestionUtils";
88

9-
// TEMPORARY CODE START
10-
import AuthClientStore from "data/auth/AuthClientStore";
11-
// TEMPORARY CODE END
12-
139
interface QuestionCardProps {
1410
question: Question;
1511
isSelected: boolean;
@@ -23,43 +19,6 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({
2319
onClick,
2420
isNarrow,
2521
}) => {
26-
// TEMPORARY CODE START
27-
const handleCreateAttempt = async () => {
28-
try {
29-
const token = AuthClientStore.getAccessToken();
30-
31-
const response = await fetch("http://localhost:3002/api/history", {
32-
method: "POST",
33-
headers: {
34-
"Content-Type": "application/json",
35-
Authorization: `Bearer ${token}`, // Passing token in header
36-
},
37-
body: JSON.stringify({
38-
question: question._id,
39-
attemptStartedAt: new Date(),
40-
attemptCompletedAt: new Date(),
41-
collaborator: "", // Leaving collaborator empty
42-
}),
43-
});
44-
45-
if (!response.ok) {
46-
throw new Error("Failed to create attempt");
47-
}
48-
49-
const data = await response.json();
50-
console.log(data);
51-
52-
message.success("Attempt created successfully");
53-
} catch (error) {
54-
if (error instanceof Error) {
55-
message.error(`Error creating attempt: ${error.message}`);
56-
} else {
57-
message.error("Unknown error occurred");
58-
}
59-
}
60-
};
61-
// TEMPORARY CODE END
62-
6322
return (
6423
<Card
6524
className={`${styles.card} ${isSelected ? styles.selectedCard : ""} ${
@@ -87,14 +46,6 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({
8746
))}
8847
</div>
8948
</div>
90-
91-
{/* TEMPORARY CODE START */}
92-
<div className={styles.createAttemptButton}>
93-
<Button type="primary" onClick={handleCreateAttempt}>
94-
Create Attempt
95-
</Button>
96-
</div>
97-
{/* TEMPORARY CODE END */}
9849
</Card>
9950
);
10051
};

0 commit comments

Comments
 (0)