Skip to content

Commit 673dffa

Browse files
add auth create context http call (#181)
1 parent e48bf18 commit 673dffa

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

lib/interface/cli/commands/auth/create-context.cmd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const { auth } = require('../../../../logic');
77
const { JWTContext, APIKeyContext } = auth.contexts;
88
const authManager = auth.manager;
99
const authRoot = require('../root/auth.cmd');
10+
const { createContext } = require('../../../../logic/api/auth');
1011

1112
const _loginWithToken = async (url, token) => {
1213
let authContext;
@@ -74,6 +75,7 @@ const command = new Command({
7475
await authManager.addContext(authContext);
7576
await authManager.setCurrentContext(authContext);
7677
await authManager.persistContexts(authContext);
78+
await createContext();
7779

7880
if (updatedExistingContext) {
7981
console.log(`Updated context: ${authContext.name}`);

lib/logic/api/auth.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { sendHttpRequest } = require('./helper');
2+
3+
4+
const createContext = async () => {
5+
const options = {
6+
url: '/api/user/context',
7+
method: 'GET',
8+
};
9+
10+
return sendHttpRequest(options);
11+
};
12+
13+
module.exports = {
14+
createContext,
15+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.8.43",
3+
"version": "0.8.44",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)