Skip to content

Commit

Permalink
Alterações para aceitar code e state.
Browse files Browse the repository at this point in the history
(Vale para ML e Bling)
  • Loading branch information
pedromuniz378 committed Oct 9, 2023
1 parent f87329c commit d1287df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

<body>
<div id="container">
<h1>Código gerado pelo Mercado Livre</h1>
<p id="p"></p>
<h1>Código gerado pela API</h1>
<p id="code"></p>
<p id="state"></p>
</div>

<script src="scripts.js"></script>
Expand Down
13 changes: 10 additions & 3 deletions scripts.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@

function getParams() {
let params = new URLSearchParams(location.search);
var paragraph = document.getElementById("p");
console.log(params)
var code = document.getElementById("code");
if (params.get('code') != null) {
paragraph.textContent = params.get('code');
code.textContent = params.get('code');
} else {
paragraph.textContent = 'Sem informações!';
code.textContent = 'Sem informações!';
}
var state = document.getElementById("state");
if (params.get('state') != null) {
state.textContent = params.get('state');
} else {
state.textContent = 'Sem informações!';
}
}

Expand Down

0 comments on commit d1287df

Please sign in to comment.