Files
enm-cli/lib/components/ENM.js
Vyacheslav.Sviridov bcc0a42f73 bulk import creation
2022-06-26 21:09:48 +06:00

33 lines
751 B
JavaScript
Executable File

const axiosHttpClient = require('./AxiosHttpClient')
class ENM {
constructor(username, password, url) {
this.logoutUrl = '/logout'
this.loginUrl = `/login?IDToken1=${username}&IDToken2=${password}`
this.commands = []
this.choices = []
this.httpClient = axiosHttpClient(url)
}
async login() {
const axiosConfig = {
text: 'Login in...',
method: 'post',
url: this.loginUrl
}
const response = await this.httpClient.request(axiosConfig)
return response.data
}
async logout() {
const axiosConfig = {
text: 'Logout...',
method: 'get',
url: this.logoutUrl
}
await this.httpClient.request(axiosConfig)
}
}
module.exports = ENM