Fix editor
This commit is contained in:
parent
a28f672516
commit
023e4da2f9
|
@ -6,10 +6,11 @@ const alertBox = (type, message) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set expiresTimestamp to the time in const ban.expiresTimestamp (convert from js date number to local time string that conforms with html form values)
|
// Set expiresTimestamp to the time in const ban.expiresTimestamp (convert from js date number to local time string that conforms with html form values)
|
||||||
const expiresTimestamp = document.getElementById('expiresTimestamp').value;
|
if (ban.expiresTimestamp !== null) {
|
||||||
const expiresDate = new Date(ban.expiresTimestamp)
|
const expiresTimestamp = document.getElementById('expiresTimestamp').value;
|
||||||
document.getElementById('expiresTimestamp').value = new Date(expiresDate.getTime() - (expiresDate.getTimezoneOffset() * 60000)).toISOString().slice(0, 16);
|
const expiresDate = new Date(ban.expiresTimestamp)
|
||||||
|
document.getElementById('expiresTimestamp').value = new Date(expiresDate.getTime() - (expiresDate.getTimezoneOffset() * 60000)).toISOString().slice(0, 16);
|
||||||
|
}
|
||||||
|
|
||||||
var reasonFlags = {};
|
var reasonFlags = {};
|
||||||
|
|
||||||
|
@ -53,20 +54,20 @@ document.getElementById('banForm').addEventListener('submit', function (event) {
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
console.log('Success:', result);
|
console.log('Success:', result);
|
||||||
// Handle success (e.g., show a success message, redirect, etc.)
|
// Handle success (e.g., show a success message, redirect, etc.)
|
||||||
window.location.href = '/admin';
|
window.location.href = '/admin';
|
||||||
} else {
|
} else {
|
||||||
console.error('Error:', result.message);
|
console.error('Error:', result.message);
|
||||||
alertBox('alert-danger', 'An error has occurred: ' + result.message);
|
alertBox('alert-danger', 'An error has occurred: ' + result.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
alertBox('alert-danger', 'An error has occurred. Please contact support.\n' + error);
|
alertBox('alert-danger', 'An error has occurred. Please contact support.\n' + error);
|
||||||
// Handle error (e.g., show an error message)
|
// Handle error (e.g., show an error message)
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in a new issue