You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/16 09:13:57 UTC

[GitHub] [airflow] pierrejeambrun commented on a diff in pull request #25098: Upgrade API file to typescript

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


##########
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') || '';

Review Comment:
   You are right, most of the `getMetaValue` are required, defaulting to an empty string is not great. We could update the method to raise instead an exception if not found instead of returning null.
   
   We could parametrize this with something like:
   ```
   function getMetaValue(name: string, required: boolean = true)
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org