Remove hardcoded chassis from Fan store

This change removes the hardcoded chassis URL from FanStore. Now
the URL is taken from the odata.id.

Signed-off-by: MichalX Szopinski <michalx.szopinski@intel.com>
Change-Id: I59e4d46a8aaa453f6662f4f396f32d7fad18fb91
diff --git a/src/store/modules/HardwareStatus/FanStore.js b/src/store/modules/HardwareStatus/FanStore.js
index fca1f32..3f172d2 100644
--- a/src/store/modules/HardwareStatus/FanStore.js
+++ b/src/store/modules/HardwareStatus/FanStore.js
@@ -38,10 +38,30 @@
     },
   },
   actions: {
-    async getFanInfo({ commit }) {
+    async getChassisCollection() {
       return await api
-        .get('/redfish/v1/Chassis/chassis/Thermal')
-        .then(({ data: { Fans = [] } }) => commit('setFanInfo', Fans))
+        .get('/redfish/v1/Chassis')
+        .then(({ data: { Members } }) =>
+          api.all(
+            Members.map((member) =>
+              api.get(member['@odata.id']).then((response) => response.data)
+            )
+          )
+        )
+        .catch((error) => console.log(error));
+    },
+    async getFanInfo({ dispatch, commit }) {
+      const collection = await dispatch('getChassisCollection');
+      if (!collection || collection.length === 0) return;
+      return await api
+        .all(collection.map((chassis) => dispatch('getChassisFans', chassis)))
+        .then((fansFromChassis) => commit('setFanInfo', fansFromChassis.flat()))
+        .catch((error) => console.log(error));
+    },
+    async getChassisFans(_, chassis) {
+      return await api
+        .get(chassis.Thermal['@odata.id'])
+        .then(({ data: { Fans } }) => Fans || [])
         .catch((error) => console.log(error));
     },
   },