mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
start move to axios
This commit is contained in:
parent
1fe09ca6ba
commit
9e14dbe6b9
@ -1,5 +1,5 @@
|
||||
const superagent = require('superagent');
|
||||
var os = require('os');
|
||||
const axios = require('axios');
|
||||
const os = require('os');
|
||||
const winston = require('winston');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@ -36,14 +36,25 @@ async function login(program) {
|
||||
var info;
|
||||
try {
|
||||
// login
|
||||
const loginRes = await superagent.post(apiEndpoint + '/login').set('accept', 'json').send({
|
||||
email: program.ddns.email,
|
||||
password: program.ddns.password
|
||||
const loginRes = await axios({
|
||||
method: 'post',
|
||||
url: apiEndpoint + '/login',
|
||||
headers: { 'Accept': 'application/json' },
|
||||
responseType: 'json',
|
||||
data: {
|
||||
email: program.ddns.email,
|
||||
password: program.ddns.password
|
||||
}
|
||||
});
|
||||
|
||||
// pull in config options
|
||||
const configRes = await superagent.get(apiEndpoint + '/account/info').set('x-access-token', loginRes.body.token).set('accept', 'json');
|
||||
info = configRes.body;
|
||||
const configRes = await axios({
|
||||
method: 'get',
|
||||
url: apiEndpoint + '/account/info',
|
||||
headers: { 'x-access-token': loginRes.data.token, 'accept': 'application/json' },
|
||||
responseType: 'json'
|
||||
});
|
||||
info = configRes.data;
|
||||
} catch (err) {
|
||||
winston.error('Login to Auto DNS Failed');
|
||||
winston.error(err.message);
|
||||
|
||||
@ -69,6 +69,7 @@
|
||||
"dependencies": {
|
||||
"archiver": "^3.0.0",
|
||||
"auto-launch": "^5.0.5",
|
||||
"axios": "^0.19.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"busboy": "^0.3.1",
|
||||
"colors": "^1.3.3",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user