From fcdfdbe53f9f981d029d0b61c13da4864063747a Mon Sep 17 00:00:00 2001 From: Latifa Al-Hitmi Date: Sat, 19 Oct 2024 22:41:31 +0300 Subject: [PATCH] fixing syntax --- public/src/admin/dashboard/bug-logs.js | 110 ++++++++++++------------- src/controllers/admin/dashboard.js | 2 +- src/routes/admin.js | 2 +- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/public/src/admin/dashboard/bug-logs.js b/public/src/admin/dashboard/bug-logs.js index fc7bc0ed1d..82267b680c 100644 --- a/public/src/admin/dashboard/bug-logs.js +++ b/public/src/admin/dashboard/bug-logs.js @@ -1,59 +1,59 @@ 'use strict'; define('admin/dashboard/bug-logs', ['jquery', 'api'], ($, api) => { - const BugLogs = {}; - - BugLogs.init = () => { - // Fetch and display bug logs - fetchBugLogs(); - - // Handle bug report submission - $('#submit-bug-report').on('click', submitBugReport); - }; - - function fetchBugLogs() { - api.get('/api/admin/get-bug-log') - .then((data) => { - const bugLogsContainer = $('#bug-logs-container'); - bugLogsContainer.empty(); - - if (data.bugLogs && data.bugLogs.length > 0) { - data.bugLogs.forEach((log) => { - const logElement = $('
').addClass('bug-log'); - logElement.append($('

').text(⁠ User: ${log.user} ⁠)); - logElement.append($('

').text(⁠ Description: ${log.description} ⁠)); - logElement.append($('

').text(⁠ Timestamp: ${log.timestamp} ⁠)); - bugLogsContainer.append(logElement); - }); - } else { - bugLogsContainer.append($('

').text('No bug logs found.')); - } - }) - .catch((err) => { - console.error('Error fetching bug logs:', err); - $('#bug-logs-container').append($('

').text('Error fetching bug logs.')); - }); - } - - function submitBugReport() { - const description = $('#bug-report-description').val().trim(); - - if (!description) { - alert('Description is required'); - return; - } - - api.post('/api/admin/submit-bug-report', { description }) - .then(() => { - alert('Bug report submitted successfully'); - $('#bug-report-description').val(''); - fetchBugLogs(); - }) - .catch((err) => { - console.error('Error submitting bug report:', err); - alert('Error submitting bug report'); - }); - } - - return BugLogs; + const BugLogs = {}; + + BugLogs.init = () => { + // Fetch and display bug logs + fetchBugLogs(); + + // Handle bug report submission + $('#submit-bug-report').on('click', submitBugReport); + }; + + function fetchBugLogs() { + api.get('/api/admin/get-bug-log') + .then((data) => { + const bugLogsContainer = $('#bug-logs-container'); + bugLogsContainer.empty(); + + if (data.bugLogs && data.bugLogs.length > 0) { + data.bugLogs.forEach((log) => { + const logElement = $('

').addClass('bug-log'); + logElement.append($('

').text(`User: ${log.user}`)); + logElement.append($('

').text(`Description: ${log.description}`)); + logElement.append($('

').text(`Timestamp: ${log.timestamp}`)); + bugLogsContainer.append(logElement); + }); + } else { + bugLogsContainer.append($('

').text('No bug logs found.')); + } + }) + .catch((err) => { + console.error('Error fetching bug logs:', err); + $('#bug-logs-container').append($('

').text('Error fetching bug logs.')); + }); + } + + function submitBugReport() { + const description = $('#bug-report-description').val().trim(); + + if (!description) { + alert('Description is required'); + return; + } + + api.post('/api/admin/submit-bug-report', { description }) + .then(() => { + alert('Bug report submitted successfully'); + $('#bug-report-description').val(''); + fetchBugLogs(); + }) + .catch((err) => { + console.error('Error submitting bug report:', err); + alert('Error submitting bug report'); + }); + } + + return BugLogs; }); \ No newline at end of file diff --git a/src/controllers/admin/dashboard.js b/src/controllers/admin/dashboard.js index 901e13e896..6042645e79 100644 --- a/src/controllers/admin/dashboard.js +++ b/src/controllers/admin/dashboard.js @@ -430,4 +430,4 @@ dashboardController.submitBugReport = async function (req, res) { console.error('Error submitting bug report:', error); // Log the error for debugging res.status(500).json({ message: 'Internal server error' }); } -}; \ No newline at end of file +}; diff --git a/src/routes/admin.js b/src/routes/admin.js index 46c5052ba7..dcfa235d3d 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -84,4 +84,4 @@ function apiRoutes(router, name, middleware, controllers) { router.post(`/api/${name}/uploadOgImage`, middlewares, helpers.tryRoute(controllers.admin.uploads.uploadOgImage)); router.post(`/api/${name}/upload/file`, middlewares, helpers.tryRoute(controllers.admin.uploads.uploadFile)); router.post(`/api/${name}/uploadDefaultAvatar`, middlewares, helpers.tryRoute(controllers.admin.uploads.uploadDefaultAvatar)); -} \ No newline at end of file +}