@heyamiko/amiko-cli 0.5.4 → 0.5.5
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/dist/index.js +10 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -75250,9 +75250,10 @@ function registerCreditsCommand(program2) {
|
|
|
75250
75250
|
try {
|
|
75251
75251
|
let balance = null;
|
|
75252
75252
|
const billingToken = auth.platformKey || auth.privyToken;
|
|
75253
|
-
|
|
75253
|
+
const base2 = auth.billingBase || "https://billing.heyamiko.com";
|
|
75254
|
+
if (billingToken) {
|
|
75254
75255
|
try {
|
|
75255
|
-
const res = await fetch(`${
|
|
75256
|
+
const res = await fetch(`${base2}/api/credits`, {
|
|
75256
75257
|
headers: {
|
|
75257
75258
|
Authorization: `Bearer ${billingToken}`
|
|
75258
75259
|
}
|
|
@@ -75260,8 +75261,14 @@ function registerCreditsCommand(program2) {
|
|
|
75260
75261
|
if (res.ok) {
|
|
75261
75262
|
const data = await res.json();
|
|
75262
75263
|
balance = data.displayBalance ?? Math.round(Number(data.credits?.balance || 0));
|
|
75264
|
+
} else {
|
|
75265
|
+
console.log(dim(` API returned ${res.status}: ${await res.text().catch(() => "")}`));
|
|
75263
75266
|
}
|
|
75264
|
-
} catch {
|
|
75267
|
+
} catch (e8) {
|
|
75268
|
+
console.log(dim(` Fetch error: ${e8.message}`));
|
|
75269
|
+
}
|
|
75270
|
+
} else {
|
|
75271
|
+
console.log(dim(" No auth token available"));
|
|
75265
75272
|
}
|
|
75266
75273
|
spinner2.stop();
|
|
75267
75274
|
if (balance !== null) {
|