UNPKG

refraction-cli

Version:
28 lines (22 loc) 612 B
import request from './request'; import { parseError } from './helpers'; import { getConfig } from './config'; const authenticate = async (): Promise<void> => { const userId = getConfig('userId'); const teamId = getConfig('teamId'); if (!userId) { throw new Error( 'Your Refraction User ID or Team ID are incorrect. Please run `refraction login` to update them.' ); } try { await request('/api/vscode/authenticate', { userId, teamId, }); } catch (error) { const message = parseError(error); throw new Error(message); } }; export default authenticate;