A lot of things
This commit is contained in:
@@ -38,6 +38,7 @@ const ERROR_TABLE = {
|
||||
* @constructor
|
||||
*/
|
||||
const SECTION = () => document.querySelector("meta[name='fs-section']")?.content ?? '';
|
||||
const CSRF = () => document.querySelector("meta[name='csrf-token']")?.content ?? '';
|
||||
|
||||
window.FSUploader = FSUploader;
|
||||
window.HashesManager = HashesManager;
|
||||
@@ -403,6 +404,31 @@ window.Submission = function(){
|
||||
}
|
||||
|
||||
e.target.submit();
|
||||
},
|
||||
|
||||
async requestFeatured( entryId ){
|
||||
const csrf = CSRF();
|
||||
|
||||
const response = await fetch(`/api/entry/${entryId}/featured`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': csrf
|
||||
}
|
||||
});
|
||||
const json = await response.json();
|
||||
|
||||
const entry_featured_button = document.querySelector('#entry-featured-button');
|
||||
const entry_featured_body = document.querySelector('#entry-featured-body');
|
||||
|
||||
if( json.success ){
|
||||
entry_featured_body.innerHTML = '<p>Request submitted</p>';
|
||||
entry_featured_button.style.display = 'none';
|
||||
} else {
|
||||
entry_featured_body.innerHTML = '<p>Request failed. Please refresh the page and retry.</p>';
|
||||
entry_featured_button.style.display = 'none';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user