[+] FetchPlayersStatus API call.

Users are now able to fetch their user data : Whitelist, Operators, BannedIps, BannedPlayers.
This commit is contained in:
Charles Le Maux 2024-08-24 13:23:23 +02:00
parent 2632f70b65
commit c60fab04c1

View File

@ -21,6 +21,7 @@
<button type="button" class="actionButton" data-action="ServerStop">Stop Server</button>
<button type="button" class="actionButton" data-action="FetchServers">Fetch Servers</button>
<button type="button" class="actionButton" data-action="FetchLogs">Fetch Logs</button>
<button type="button" class="actionButton" data-action="FetchPlayersStatus">Fetch Players Status</button>
</form>
@ -50,7 +51,7 @@ document.addEventListener('DOMContentLoaded', () => {
buttons.forEach(button => {
button.addEventListener('click', async event => {
const action = button.dataset.action;
const token = "MpkbDMOO8PQddQgB5VgBQdTMWF53";
const token = "kPbH7QbrOzTrNcpqTnZGDJfSj3E3";
const framework = document.getElementById('serverFramework').value;
const subdomain = document.getElementById('subdomain').value;
const email = document.getElementById('accountEmail').value;
@ -69,6 +70,9 @@ document.addEventListener('DOMContentLoaded', () => {
case 'FetchLogs':
data = {token, name};
break;
case 'FetchPlayersStatus':
data = {token, name};
break;
case 'AccountCreate':
data = {email, port, token};
break;
@ -105,7 +109,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
function sendRequest(endpoint, payload) {
return fetch(`http://127.0.0.1:3000/${endpoint}`, {
return fetch(`http://localhost:3000/${endpoint}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'