Skip to content

Commit

Permalink
Refactor script imports in index.php and admin.js
Browse files Browse the repository at this point in the history
  • Loading branch information
judemont committed Sep 26, 2024
1 parent fc38296 commit 38a58ee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<body>
<div id='content'></div>
<script src="../scripts/admin.js"></script>
<script src="scripts/moderation.js"></script>
<script src="../scripts/moderation.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion api/recive_all.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

$mediaDir = __DIR__ . '/../medias/';
$files = array_diff(scandir($mediaDir), ['.', '..']);

shuffle($files);
echo json_encode(['success' => true, 'files' => array_values($files)]);
?>
2 changes: 2 additions & 0 deletions scripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ document.addEventListener('DOMContentLoaded', () => {
const basePath = ".."
const apiPath = `${basePath}/api/recive_all.php`;
const mediaPath = `${basePath}/medias/`;


function fetchMedias() {
fetch(apiPath)
Expand All @@ -28,5 +29,6 @@ document.addEventListener('DOMContentLoaded', () => {
.catch(error => console.error('Stupid error :', error));
}


fetchMedias();
});

0 comments on commit 38a58ee

Please sign in to comment.