Skip to content

Commit

Permalink
add auth create context http call (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
ziv-codefresh authored Apr 23, 2018
1 parent e48bf18 commit 673dffa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/interface/cli/commands/auth/create-context.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { auth } = require('../../../../logic');
const { JWTContext, APIKeyContext } = auth.contexts;
const authManager = auth.manager;
const authRoot = require('../root/auth.cmd');
const { createContext } = require('../../../../logic/api/auth');

const _loginWithToken = async (url, token) => {
let authContext;
Expand Down Expand Up @@ -74,6 +75,7 @@ const command = new Command({
await authManager.addContext(authContext);
await authManager.setCurrentContext(authContext);
await authManager.persistContexts(authContext);
await createContext();

if (updatedExistingContext) {
console.log(`Updated context: ${authContext.name}`);
Expand Down
15 changes: 15 additions & 0 deletions lib/logic/api/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { sendHttpRequest } = require('./helper');


const createContext = async () => {
const options = {
url: '/api/user/context',
method: 'GET',
};

return sendHttpRequest(options);
};

module.exports = {
createContext,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.8.43",
"version": "0.8.44",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 673dffa

Please sign in to comment.