diff options
Diffstat (limited to 'public/js')
| -rw-r--r-- | public/js/maintenance.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/public/js/maintenance.js b/public/js/maintenance.js new file mode 100644 index 0000000..7406e0a --- /dev/null +++ b/public/js/maintenance.js | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | function displayLogs(){ | ||
| 2 | const log_table = getElementOrThrow('log_table'); | ||
| 3 | console.log(log_table); | ||
| 4 | |||
| 5 | let fetcher = new Fetcher({ | ||
| 6 | endpoint: 'index.php?action=get_logs', | ||
| 7 | method: 'POST', | ||
| 8 | onSuccess: (data) => { | ||
| 9 | log_table.innerHTML = data.view; | ||
| 10 | console.log(log_table); | ||
| 11 | }, | ||
| 12 | onFailure: () => { | ||
| 13 | toastNotify("Aucune donnée disponible"); | ||
| 14 | } | ||
| 15 | }); | ||
| 16 | fetcher.send({}); | ||
| 17 | } | ||
| 18 | function cleanLogs(){ | ||
| 19 | if(!confirm('Voulez-vous vraiment supprimer cette entrée?')){ | ||
| 20 | return; | ||
| 21 | } | ||
| 22 | const log_table = getElementOrThrow('log_table'); | ||
| 23 | |||
| 24 | let fetcher = new Fetcher({ | ||
| 25 | endpoint: 'index.php?action=erase_logs', | ||
| 26 | method: 'POST', | ||
| 27 | onSuccess: () => { | ||
| 28 | log_table.innerHTML = ''; | ||
| 29 | toastNotify('Les journaux de connexion ont été effacés'); | ||
| 30 | }, | ||
| 31 | onFailure: () => { | ||
| 32 | toastNotify("L'application a rencontré une erreur, rien n'a été effacé"); | ||
| 33 | } | ||
| 34 | }); | ||
| 35 | fetcher.send({}); | ||
| 36 | } \ No newline at end of file | ||
