[INS-1724] creating a gRPC request should activate that request (#5037)

This commit is contained in:
Dimitri Mitropoulos 2022-08-02 09:19:14 -04:00 committed by GitHub
parent a479860c23
commit 4414005b9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,19 +62,17 @@ export const createRequest: RequestCreator = async ({
requestType,
workspaceId,
}) => {
let requestId = '';
switch (requestType) {
case 'gRPC': {
showModal(ProtoFilesModal, {
onSave: async (protoFileId: string) => {
const createdRequest = await models.grpcRequest.create({
const request = await models.grpcRequest.create({
parentId,
name: 'New Request',
protoFileId,
});
models.stats.incrementCreatedRequests();
requestId = createdRequest._id;
setActiveRequest(request._id, workspaceId);
},
});
break;
@ -97,7 +95,7 @@ export const createRequest: RequestCreator = async ({
name: 'New Request',
});
models.stats.incrementCreatedRequests();
requestId = request._id;
setActiveRequest(request._id, workspaceId);
break;
}
@ -108,7 +106,7 @@ export const createRequest: RequestCreator = async ({
name: 'New Request',
});
models.stats.incrementCreatedRequests();
requestId = request._id;
setActiveRequest(request._id, workspaceId);
break;
}
@ -120,5 +118,4 @@ export const createRequest: RequestCreator = async ({
}
trackSegmentEvent(SegmentEvent.requestCreate, { requestType });
setActiveRequest(requestId, workspaceId);
};