@embeddable.com/sdk-core 2.4.5 → 2.4.6
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/lib/index.esm.js +12 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +12 -8
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -4655,7 +4655,7 @@ async function selectWorkspace(ctx, token) {
|
|
|
4655
4655
|
color: "green",
|
|
4656
4656
|
discardStdin: false,
|
|
4657
4657
|
}).start();
|
|
4658
|
-
const availableWorkspaces = await getWorkspaces(ctx, token);
|
|
4658
|
+
const availableWorkspaces = await getWorkspaces(ctx, token, workspaceSpinner);
|
|
4659
4659
|
let selectedWorkspace;
|
|
4660
4660
|
if (availableWorkspaces.length === 0) {
|
|
4661
4661
|
workspaceSpinner.fail("No workspaces found");
|
|
@@ -4725,19 +4725,23 @@ async function sendBuild(ctx, { workspaceId, token }) {
|
|
|
4725
4725
|
});
|
|
4726
4726
|
await fs.rm(ctx.client.archiveFile);
|
|
4727
4727
|
}
|
|
4728
|
-
async function getWorkspaces(ctx, token) {
|
|
4728
|
+
async function getWorkspaces(ctx, token, workspaceSpinner) {
|
|
4729
4729
|
try {
|
|
4730
|
-
|
|
4731
|
-
.get(`${ctx.pushBaseUrl}/workspace`, {
|
|
4730
|
+
const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
|
|
4732
4731
|
headers: {
|
|
4733
4732
|
Authorization: `Bearer ${token}`,
|
|
4734
4733
|
},
|
|
4735
|
-
})
|
|
4736
|
-
|
|
4734
|
+
});
|
|
4735
|
+
return response.data;
|
|
4737
4736
|
}
|
|
4738
4737
|
catch (e) {
|
|
4739
|
-
|
|
4740
|
-
|
|
4738
|
+
if (e.response.status === 401) {
|
|
4739
|
+
workspaceSpinner.fail("Invalid token. Please login again.");
|
|
4740
|
+
}
|
|
4741
|
+
else {
|
|
4742
|
+
workspaceSpinner.fail("Failed to fetch workspaces");
|
|
4743
|
+
}
|
|
4744
|
+
process.exit(1);
|
|
4741
4745
|
}
|
|
4742
4746
|
}
|
|
4743
4747
|
|