@@ -6,10 +6,6 @@ import { Question } from "../../domain/entities/Question";
6
6
import styles from "./QuestionCard.module.css" ;
7
7
import { getDifficultyColor } from "presentation/utils/QuestionUtils" ;
8
8
9
- // TEMPORARY CODE START
10
- import AuthClientStore from "data/auth/AuthClientStore" ;
11
- // TEMPORARY CODE END
12
-
13
9
interface QuestionCardProps {
14
10
question : Question ;
15
11
isSelected : boolean ;
@@ -23,43 +19,6 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({
23
19
onClick,
24
20
isNarrow,
25
21
} ) => {
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
-
63
22
return (
64
23
< Card
65
24
className = { `${ styles . card } ${ isSelected ? styles . selectedCard : "" } ${
@@ -87,14 +46,6 @@ export const QuestionCard: React.FC<QuestionCardProps> = ({
87
46
) ) }
88
47
</ div >
89
48
</ 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 */ }
98
49
</ Card >
99
50
) ;
100
51
} ;
0 commit comments