INNER CODE UNIT · JavaScript
callAPI
apache/cloudstack · ui/src/api/index.js:81
export function callAPI (command, args = {}) {
const isGetAPICommand = getAPICommandsRegex.test(command) || additionalGetAPICommandsList.includes(command.toLowerCase())
const call = isGetAPICommand ? getAPI : postAPI
return call(command, args)
}
export function login (arg) {
if (!sourceToken.checkExistSource()) {
sourceToken.init()
}
// Logout before login is called to purge any duplicate sessionkey cookies
postAPI('logout')
const params = new URLSearchParams()
params.append('command', 'login')
params.append('username', arg.username || arg.email)
params.append('password', arg.password)