MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / handleCreateConfirm

Function handleCreateConfirm

frontend/src/components/apiKey/index.tsx:168–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166 }
167 }
168 const handleCreateConfirm = async () => {
169 if (id) {
170 form1.validateFields().then(async () => {
171 setLoading(true);
172 const params = {
173 name: createNameValue,
174 }
175 try {
176 await updateApiKeys(id, params)
177 setOpenEditAPIKey(false)
178 toast.success(`${t('updateSuccessful')}`)
179
180 } catch (e) {
181 console.log(e)
182 const errorResponse = e as ApiErrorResponse;
183 const errorMessage: string = errorResponse.response.data.error.message;
184 toast.error(errorMessage)
185 }
186 dispatch(fetchApikeysData(20) as any);
187 setLoading(false);
188 await form1.resetFields()
189 await form1.setFieldsValue({ name: '' });
190 }).catch((errorInfo) => {
191 console.log(errorInfo)
192 })
193 return
194 } else {
195 form.validateFields().then(async () => {
196 setConfirmLoading(true);
197 const params = {
198 name: createNameValue,
199 }
200 try {
201 await createApiKeys(params)
202 setOpenCreateAPIKey(false)
203 toast.success(`${t('creationSuccessful')}`)
204
205 } catch (e) {
206 console.log(e)
207 const errorResponse = e as ApiErrorResponse;
208 const errorMessage: string = errorResponse.response.data.error.message;
209 toast.error(errorMessage)
210 }
211
212 dispatch(fetchApikeysData(20) as any);
213 setConfirmLoading(false);
214 await form.resetFields()
215 await form.setFieldsValue({ name: '' });
216 }).catch((errorInfo) => {
217 console.log(errorInfo)
218 })
219 return
220 }
221 }
222 const handleChildEvent = async (value: Record<string, any>) => {
223 await fetchData(value);
224 }

Callers

nothing calls this directly

Calls 4

updateApiKeysFunction · 0.90
fetchApikeysDataFunction · 0.90
createApiKeysFunction · 0.90
setLoadingFunction · 0.85

Tested by

no test coverage detected