diff --git a/src/Moonglade.Web/Pages/Admin/Category.cshtml b/src/Moonglade.Web/Pages/Admin/Category.cshtml
index 4f0926cd3..8103924b6 100644
--- a/src/Moonglade.Web/Pages/Admin/Category.cshtml
+++ b/src/Moonglade.Web/Pages/Admin/Category.cshtml
@@ -5,6 +5,7 @@
}
@section scripts{
+
}
diff --git a/src/Moonglade.Web/wwwroot/js/app/dataexport.js b/src/Moonglade.Web/wwwroot/js/app/dataexport.js
new file mode 100644
index 000000000..2b11e9d0d
--- /dev/null
+++ b/src/Moonglade.Web/wwwroot/js/app/dataexport.js
@@ -0,0 +1,23 @@
+function downloadCSV(csvData, filename) {
+ const blob = new Blob([csvData], { type: 'text/csv' });
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.setAttribute('hidden', '');
+ a.setAttribute('href', url);
+ a.setAttribute('download', filename);
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+}
+
+function exportCSV(api, filename) {
+ fetch(api)
+ .then(response => response.json())
+ .then(data => {
+ const csvData = convertJSONtoCSV(data);
+ downloadCSV(csvData, filename);
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ });
+}
\ No newline at end of file