Skip to content

Commit

Permalink
Merge pull request #8 from danvitoriano/POST-1.0.0-RC
Browse files Browse the repository at this point in the history
Post 1.0.0 RC
  • Loading branch information
danvitoriano authored Nov 3, 2016
2 parents 8ce71f0 + e69cd4e commit 48d8bae
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
45 changes: 45 additions & 0 deletions js/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
;
(function() {

var xhr = new XMLHttpRequest();

xhr.open('GET', "//ipinfo.io/json", true);
xhr.send();

xhr.onreadystatechange = processRequest;

function processRequest(e){
if(xhr.readyState == 4 && xht.status == 200){
var response = JSON.parse(xhr.responseText);
alert(response.ip);
}
}


// if (document.querySelector('#email') && document.querySelector('#password')) {
// var req = {
// method: 'POST',
// url: 'http://projeto-3.homolog.infra:15000/oi-partner-api/oauth/authorize?client_id=web-client&response_type=token&redirect_uri=http://localhost:3000/login/',
// data: {
// login: $scope.user,
// password: $scope.password,
// type: 'LOGIN_CPF',
// service: 'CLOUD'
// },
// headers: {
// 'Audit': $scope.user,
// 'Content-Type': 'application/json',
// 'Partner': 'CASAS_BAHIA'
// }

// }

// $http(req).then(function(response) {
// console.log('enviou');
// }, function(response) {
// console.log('não enviou');
// });
// };


})();
7 changes: 3 additions & 4 deletions login.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3>
<input type="email" name="email" id="email">
<label for="password">Password</label>
<input type="password" name="password" id="password">
<button type="submit">Submit</button>
<button type="submit" onclick="processRequest()">Submit</button>
</fieldset>
</form>

Expand All @@ -46,8 +46,7 @@ <h3>

</section>

<script>

</script>
<script src="/js/login.js" type="text/javascript"></script>

</body>
</html>

0 comments on commit 48d8bae

Please sign in to comment.