pierrejeambrun commented on code in PR #25098:
URL: https://github.com/apache/airflow/pull/25098#discussion_r923260318


##########
airflow/www/static/js/api/useClearRun.ts:
##########
@@ -17,30 +17,30 @@
  * under the License.
  */
 
-import axios from 'axios';
+import axios, { AxiosResponse } from 'axios';
 import { useMutation, useQueryClient } from 'react-query';
 import { getMetaValue } from '../utils';
 import { useAutoRefresh } from '../context/autorefresh';
 import useErrorToast from '../utils/useErrorToast';
 
-const csrfToken = getMetaValue('csrf_token');
-const clearRunUrl = getMetaValue('dagrun_clear_url');
+const csrfToken = getMetaValue('csrf_token') || '';
+const clearRunUrl = getMetaValue('dagrun_clear_url') || '';
 
-export default function useClearRun(dagId, runId) {
+export default function useClearRun(dagId: string, runId: string) {
   const queryClient = useQueryClient();
   const errorToast = useErrorToast();
   const { startRefresh } = useAutoRefresh();
   return useMutation(
     ['dagRunClear', dagId, runId],
-    ({ confirmed = false }) => {
+    ({ confirmed = false }: { confirmed: boolean }) => {
       const params = new URLSearchParams({
         csrf_token: csrfToken,
-        confirmed,
+        confirmed: confirmed.toString(),

Review Comment:
   This could be a good idea, to avoid repeating multiple `toString` 
everywhere. I am just afraid that the implementation for casting all values 
(potentially any type) to string will be hard to keep clean.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to