Skip to content
Snippets Groups Projects
Commit 7c642e25 authored by michael.minelli's avatar michael.minelli
Browse files

EnonceCreate => Add confirmation message with informations

parent eb22282d
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ import SessionManager from '../../managers/SessionManager';
import GitlabUser from '../../shared/types/Gitlab/GitlabUser';
import DojoBackendManager from '../../managers/DojoBackendManager';
import Toolbox from '../../shared/Toolbox';
import Enonce from '../../types/Enonce';
class EnonceCreateCommand extends CommanderCommand {
......@@ -122,9 +123,24 @@ class EnonceCreateCommand extends CommanderCommand {
{
console.log(chalk.cyan('Please wait while we are creating the enonce...'));
const enonce = await DojoBackendManager.createProject(options.name, members, templateIdOrNamespace);
try {
const enonce: Enonce = await DojoBackendManager.createProject(options.name, members, templateIdOrNamespace);
console.log(enonce);
const oraInfo = (message: string) => {
ora({
text : message,
indent: 4
}).start().info();
};
oraInfo(`Dojo ID: ${ enonce.id }`);
oraInfo(`Name: ${ enonce.name }`);
oraInfo(`Web URL: ${ enonce.gitlabCreationInfo.web_url }`);
oraInfo(`HTTP Repo: ${ enonce.gitlabCreationInfo.http_url_to_repo }`);
oraInfo(`SSH Repo: ${ enonce.gitlabCreationInfo.ssh_url_to_repo }`);
} catch ( error ) {
return;
}
}
}
}
......
......@@ -5,6 +5,7 @@ import ApiRoutes from '../types/ApiRoutes';
import { StatusCodes } from 'http-status-codes';
import Enonce from '../types/Enonce';
import GitlabUser from '../shared/types/Gitlab/GitlabUser';
import DojoResponse from '../types/DojoResponse';
class DojoBackendManager {
......@@ -68,12 +69,16 @@ class DojoBackendManager {
}
try {
const response = await axios.post<Enonce>(this.getApiUrl(ApiRoutes.ENONCE_CREATE), Object.assign({
const response = await axios.post<DojoResponse<Enonce>>(this.getApiUrl(ApiRoutes.ENONCE_CREATE), Object.assign({
name : name,
members: JSON.stringify(members)
}, templateIdOrNamespace ? { template: templateIdOrNamespace } : {}));
return response.data;
if ( verbose ) {
spinner.succeed(`Enonce successfully created`);
}
return response.data.data;
} catch ( error ) {
if ( verbose ) {
if ( error instanceof AxiosError ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment