Refactor: Stats card: Use typedef tags inside data fetcher (#3056)

This commit is contained in:
Alexandr Garbuzov
2023-08-09 09:22:44 +02:00
committed by GitHub
parent 20f0868a17
commit 72cfdf832d
2 changed files with 20 additions and 6 deletions
+7 -2
View File
@@ -6,11 +6,16 @@ const PATs = Object.keys(process.env).filter((key) =>
).length;
const RETRIES = PATs ? PATs : 7;
/**
* @typedef {import("axios").AxiosResponse} AxiosResponse Axios response.
* @typedef {(variables: object, token: string) => Promise<AxiosResponse>} FetcherFunction Fetcher function.
*/
/**
* Try to execute the fetcher function until it succeeds or the max number of retries is reached.
*
* @param {object[]} fetcher The fetcher function.
* @param {object[]} variables Object with arguments to pass to the fetcher function.
* @param {FetcherFunction} fetcher The fetcher function.
* @param {object} variables Object with arguments to pass to the fetcher function.
* @param {number} retries How many times to retry.
* @returns {Promise<T>} The response from the fetcher function.
*/