Update v1.0.0-beta.12, addition of external APIs and optimization
Some checks failed
continuous-integration/drone/push Build was killed
continuous-integration/drone Build was killed

This commit is contained in:
2024-05-28 20:20:52 +02:00
parent b48abc756d
commit d76a781680
19 changed files with 742 additions and 169 deletions

View File

@@ -91,6 +91,11 @@
</select>
<button type="submit" class="btn btn-primary btn-round custom-btn">Mettre à jour</button>
</form>
<form action="/api/dpanel/generate-token" method="POST" class="d-flex align-items-center mt-2">
<input type="hidden" name="id" value="<%= user.id %>">
<input type="hidden" name="name" value="<%= user.name %>">
<button type="submit" class="btn btn-secondary btn-round custom-btn">Générer Token</button>
</form>
</td>
</tr>
<% }) %>
@@ -187,6 +192,46 @@
var searchInput = document.getElementById('searchInput');
searchInput.placeholder = isMac ? 'Rechercher par nom ou ID (Cmd + K)' : 'Rechercher par nom ou ID (Ctrl + K)';
document.querySelectorAll('form').forEach(form => {
form.addEventListener('submit', function(e) {
e.preventDefault();
var url = this.getAttribute('action');
var method = this.getAttribute('method');
var name = this.querySelector('input[name="name"]').value;
var id = this.querySelector('input[name="id"]').value;
var data = { name: name, id: id };
fetch(url, {
method: method,
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(response => {
Swal.fire({
title: 'Votre Token',
html: `<input type="text" id="swal-input1" class="swal2-input" value="${response.token}">`,
confirmButtonText: 'Copier le Token',
footer: '<div style="text-align: center;">Gardez ce token en sécurité. Il ne sera pas possible de le récupérer sans le régénérer.</div>',
focusConfirm: false,
preConfirm: () => {
const copyText = document.querySelector('#swal-input1');
copyText.select();
document.execCommand("copy");
}
}).then(() => {
Swal.fire('Copié!', 'Votre token a été copié.', 'success');
});
})
.catch(error => {
Swal.fire('Error', error.message, 'error');
});
});
});
</script>
</body>