multicloud_rule_manager 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/retrieve.js +14 -14
- package/package.json +1 -1
package/commands/retrieve.js
CHANGED
|
@@ -27,27 +27,27 @@ export default {
|
|
|
27
27
|
})
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const loginData = await loginResp.json(); // leggi direttamente JSON
|
|
31
|
+
const access_token = loginData.access_token;
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!access_token) throw new Error("Token non ricevuto nel campo 'access'");
|
|
38
|
-
} catch (err) {
|
|
39
|
-
throw new Error(`Token JSON parsing failed: ${err.message}`);
|
|
40
|
-
}
|
|
33
|
+
console.log("🔹 Token response raw:", access_token);
|
|
34
|
+
|
|
35
|
+
if (!access_token) {
|
|
36
|
+
throw new Error("Token non ricevuto nel campo 'access_token'");
|
|
37
|
+
}
|
|
41
38
|
|
|
42
39
|
|
|
43
40
|
|
|
44
41
|
// --- SECONDA CHIAMATA: retrieve ---
|
|
45
42
|
console.log("🔹 Inizio richiesta dati API...");
|
|
46
43
|
const apiResp = await fetch(`https://eon-dev-01.bit2win.cloud/api/data/v1/rules/`, { // usa dominio fisso
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
method: "GET",
|
|
45
|
+
headers: {
|
|
46
|
+
Authorization: `Bearer ${access_token}`,
|
|
47
|
+
Accept: "*/*",
|
|
48
|
+
"User-Agent": "PostmanRuntime/7.51.1",
|
|
49
|
+
"Host": "eon-dev-01.bit2win.cloud"
|
|
50
|
+
}
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
console.log("🔹 API status:", apiResp.status);
|