load_stats()

in frontend/src/store.js [138:164]


    load_stats(state, payload) {
      if (payload.url === undefined) {
        state.commit("reset_stats");
      }
      const url = payload.url || BACKEND_URL + "/v1/check/stats/";

      const params = {};
      if (payload.since !== undefined) {
        params.since = payload.since;
      }

      // Remove null values from params
      Object.entries(params).forEach(([k, v]) => {
        if (v === null) delete params[k];
      });

      axios.get(url, { params }).then((resp) => {
        // Store new stats
        state.commit("add_stats", resp.data);

        // Load next stats
        if (resp.data.next !== null) {
          // Do not propagate since, as it's already included in the next
          state.dispatch("load_stats", { url: resp.data.next });
        }
      });
    },