Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import log from '../../logger'
import endpoint from '../../endpoint'
import {version} from '../../../package.json'
import {
getLogin,
saveToken,
saveLogin,
getAccount,
saveAccount,
getWorkspace,
saveWorkspace,
} from '../../conf'
let workspaces = safeGetClient('workspaces')
const vtexid = new ID(endpoint('vtexid'), {
authToken: 'abc123',
userAgent: `Toolbelt/${version}`,
})
const [account, login, workspace] = [getAccount(), getLogin(), getWorkspace()]
function safeGetClient (client) {
const clients = '../../clients.js'
try {
delete require.cache[require.resolve(clients)]
return require(clients)[client]
} catch (e) {}
}
function isVtexUser (email) {
return email.indexOf('@vtex.com') >= 0
}