extract logIn
This commit is contained in:
parent
e02dcc384e
commit
7f5be2a566
|
@ -1,4 +1,4 @@
|
|||
const config = require('../config');
|
||||
const dataLogIn = require('../server');
|
||||
const got = require('got');
|
||||
const filter = require('../utilities/filter');
|
||||
const insertDB = require('../db/insertDB');
|
||||
|
@ -38,7 +38,8 @@ function bindShelvingTag(barcode, shelving, level) {
|
|||
|
||||
function insertShelving(shelvingId) {
|
||||
(async() => {
|
||||
const info = await config.info;
|
||||
const info = await dataLogIn.dataLogIn;
|
||||
console.log(info);
|
||||
let key = info.data.token;
|
||||
let currentUser = info.data.currentUser;
|
||||
(async() => {
|
||||
|
@ -68,12 +69,12 @@ function insertShelving(shelvingId) {
|
|||
|
||||
function bindShelving(barcode, shelvingId) {
|
||||
(async() => {
|
||||
const info = await config.info;
|
||||
const info = await dataLogIn.dataLogIn;
|
||||
let key = info.data.token;
|
||||
(async() => {
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/bind/batchBind', { // eslint-disable-line
|
||||
json: {
|
||||
storeId: config.storeId,
|
||||
storeId: dataLogIn.storeId,
|
||||
tagItemBinds: [{
|
||||
eslBarcode: barcode,
|
||||
itemBarcode: shelvingId
|
||||
|
|
|
@ -25,10 +25,10 @@ function ticketCollection(collectionFk) {// parametro collectionFk
|
|||
}
|
||||
|
||||
function insertTicket(consultaSql, shelving, max) {
|
||||
const config = require('../config');
|
||||
const dataLogIn = require('../server');
|
||||
const got = require('got');
|
||||
(async() => {
|
||||
const info = await config.info;
|
||||
const info = await dataLogIn.dataLogIn;
|
||||
let key = info.data.token;
|
||||
let currentUser = info.data.currentUser;
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
const info = (async() => {
|
||||
const config = require('../config');
|
||||
const encrypt = require('../utilities/encrypted');
|
||||
const got = require('got');
|
||||
|
||||
const {body} = await got.post('http://app.etiquetaselectronicas.com:9999/user/login', {
|
||||
json: {
|
||||
account: config.user,
|
||||
loginType: 3,
|
||||
password: await encrypt.encryptPassword(config.password)
|
||||
},
|
||||
responseType: 'json'
|
||||
});
|
||||
return body;
|
||||
})();
|
||||
|
||||
exports.info = info;
|
|
@ -1,6 +1,10 @@
|
|||
const express = require('express');
|
||||
const app = express();
|
||||
const port = 9999;
|
||||
const logIn = require('./methods/logIn');
|
||||
|
||||
const dataLogIn = logIn.info;
|
||||
exports.dataLogIn = dataLogIn;
|
||||
|
||||
app.use('/bindShelving', require('./methods/bindShelvingTag'));
|
||||
app.use('/insertTicket', require('./methods/bindTicketShelving'));
|
||||
|
|
Reference in New Issue