@@ -31,22 +31,6 @@ interface Props {
31
31
listId : string ;
32
32
}
33
33
34
- const updateList = async ( name : string , listId : string ) => {
35
- await updateProblemList ( name , listId ) ;
36
- } ;
37
-
38
- const addItem = async ( problemId : string , listId : string ) => {
39
- await addProblemItem ( problemId , listId ) ;
40
- } ;
41
-
42
- const deleteItem = async ( problemId : string , listId : string ) => {
43
- await deleteProblemItem ( problemId , listId ) ;
44
- } ;
45
-
46
- const updateItem = async ( problemId : string , memo : string , listId : string ) => {
47
- await updateProblemItem ( problemId , memo , listId ) ;
48
- } ;
49
-
50
34
export const SingleProblemList = ( props : Props ) => {
51
35
const { listId } = props ;
52
36
const loginState = useLoginState ( ) ;
@@ -94,7 +78,7 @@ export const SingleProblemList = (props: Props) => {
94
78
< h2 >
95
79
< DoubleClickEdit
96
80
modifiable = { modifiable }
97
- saveText = { ( name ) => updateList ( name , listId ) }
81
+ saveText = { async ( name ) => await updateProblemList ( name , listId ) }
98
82
initialText = { listInfo . internal_list_name }
99
83
/>
100
84
</ h2 >
@@ -105,8 +89,8 @@ export const SingleProblemList = (props: Props) => {
105
89
{ adding ? (
106
90
< ProblemSearchBox
107
91
problems = { problems }
108
- selectProblem = { ( problem ) =>
109
- addItem ( problem . id , listId ) . then ( ( ) =>
92
+ selectProblem = { async ( problem ) =>
93
+ await addProblemItem ( problem . id , listId ) . then ( ( ) =>
110
94
problemListFetch . mutate ( )
111
95
)
112
96
}
@@ -139,13 +123,15 @@ export const SingleProblemList = (props: Props) => {
139
123
key = { item . problem_id }
140
124
item = { item }
141
125
problem = { problem }
142
- saveText = { ( memo : string ) =>
143
- updateItem ( item . problem_id , memo , listId ) . then ( ( ) =>
144
- problemListFetch . mutate ( )
145
- )
126
+ saveText = { async ( memo : string ) =>
127
+ await updateProblemItem (
128
+ item . problem_id ,
129
+ memo ,
130
+ listId
131
+ ) . then ( ( ) => problemListFetch . mutate ( ) )
146
132
}
147
- deleteItem = { ( ) =>
148
- deleteItem ( item . problem_id , listId ) . then ( ( ) =>
133
+ deleteItem = { async ( ) =>
134
+ await deleteProblemItem ( item . problem_id , listId ) . then ( ( ) =>
149
135
problemListFetch . mutate ( )
150
136
)
151
137
}
0 commit comments