Pārlūkot izejas kodu

Distribution: test random object in bags

Joystream Stats 2 gadi atpakaļ
vecāks
revīzija
cf3bbdaf38
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      src/components/Distribution/util.ts

+ 2 - 1
src/components/Distribution/util.ts

@@ -25,7 +25,8 @@ export const testBag = async (
 ): Promise<[string, number]> => {
   if (!objects) return `warning`;
   if (!objects.length) return ``;
-  const url = endpoint + `api/v1/assets/${objects[0].id}`;
+  const object = Math.round(Math.random() * (objects.length - 1));
+  const url = endpoint + `api/v1/assets/${objects[object].id}`;
   return axios
     .head(url)
     .then((data) => `success`)