Created
February 14, 2018 18:33
-
-
Save nenodias/4bc96be3a7d23cd092fe21f72e1cfcdc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let PORTA = '8080'; | |
| let HOST = 'localhost'; | |
| let servidor = "http://" + HOST + ":" + PORTA; | |
| let headers = new Headers(); | |
| headers.append("Accept","application/json"); | |
| headers.append("Content-type","application/json"); | |
| let dadosLogin = { | |
| "login":"MASTER", | |
| "senha":"MSTR" | |
| }; | |
| let config = { | |
| method:'POST', | |
| headers:headers, | |
| body:JSON.stringify(dadosLogin) | |
| }; | |
| let emitente = 1; | |
| let produto = '11NA-70010.BR'; | |
| fetch(`${servidor}/supervisor/ws/login`, config).then(function(res){ | |
| return res.json(); | |
| }).then(function(retorno){ | |
| console.log(retorno); | |
| return retorno.token; | |
| }).then(function(token){ | |
| config['method'] = 'GET'; | |
| delete config['body']; | |
| return fetch(`${servidor}/estoque/ws/estoque/visualizarEstoqueDisponivel?token=${token}&emitente=${emitente}&produto=${produto}`, config).then(function(res){ | |
| return res.json(); | |
| }); | |
| }).then(function(dados){ | |
| console.log(dados); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment