1
1
Fork 0
novelmetrix-python/ras/frontend/static/js/src_components_Data_js.js

2 lines
6.4 KiB
JavaScript

/*! For license information please see src_components_Data_js.js.LICENSE.txt */
"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([["src_components_Data_js"],{"./src/Functions.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "initDataTable": () => (/* binding */ initDataTable),\n/* harmony export */ "readCookie": () => (/* binding */ readCookie)\n/* harmony export */ });\nconst readCookie = name => {\n var nameEQ = name + "=";\n var ca = document.cookie.split(\';\');\n for (var i = 0; i < ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == \' \') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n};\nconst initDataTable = () => {\n let table = new DataTable(\'#DataTable\');\n table.destroy();\n setTimeout(() => {\n table = new DataTable(\'#DataTable\', {\n language: {\n url: \'https://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Dutch.json\',\n search: "",\n searchPlaceholder: "Zoeken"\n },\n dom: \'rt<"bottom"pl><"clear">\',\n order: []\n });\n }, 300);\n};\n\n//# sourceURL=webpack://frontend/./src/Functions.js?')},"./src/components/Data.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "deleteChallenge": () => (/* binding */ deleteChallenge),\n/* harmony export */ "getAllBooks": () => (/* binding */ getAllBooks),\n/* harmony export */ "getAllChallenges": () => (/* binding */ getAllChallenges),\n/* harmony export */ "getAvgRatings": () => (/* binding */ getAvgRatings),\n/* harmony export */ "getBooksPerYearPerGenres": () => (/* binding */ getBooksPerYearPerGenres),\n/* harmony export */ "getChallenge": () => (/* binding */ getChallenge),\n/* harmony export */ "getGenresCount": () => (/* binding */ getGenresCount),\n/* harmony export */ "getRatingsCount": () => (/* binding */ getRatingsCount),\n/* harmony export */ "getReadingYears": () => (/* binding */ getReadingYears),\n/* harmony export */ "getStats": () => (/* binding */ getStats),\n/* harmony export */ "insertChallenge": () => (/* binding */ insertChallenge)\n/* harmony export */ });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Functions */ "./src/Functions.js");\n\nconst getAllBooks = () => {\n return fetch(\'/api/books/all\', {\n "method": "GET",\n "headers": {\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getAllChallenges = () => {\n return fetch(\'/api/books/challenges\', {\n "method": "GET",\n "headers": {\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst insertChallenge = data => {\n return fetch(\'/api/books/challenges/insert\', {\n "method": "POST",\n "headers": {\n "Authorization": "Bearer " + localStorage.getItem("token"),\n \'Content-Type\': \'application/x-www-form-urlencoded\',\n "X-CSRFToken": (0,_Functions__WEBPACK_IMPORTED_MODULE_0__.readCookie)(\'csrftoken\')\n },\n "body": data\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst deleteChallenge = id => {\n return fetch(\'/api/books/challenges/\' + id + \'/delete\', {\n "method": "DELETE",\n "headers": {\n "Authorization": "Bearer " + localStorage.getItem("token"),\n \'Content-Type\': \'application/x-www-form-urlencoded\',\n "X-CSRFToken": (0,_Functions__WEBPACK_IMPORTED_MODULE_0__.readCookie)(\'csrftoken\'),\n "challengeid": id\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getStats = year => {\n return fetch(\'/api/books/stats\', {\n "method": "GET",\n "headers": {\n "year": year,\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getChallenge = year => {\n return fetch(\'/api/books/challenge\', {\n "method": "GET",\n "headers": {\n "year": year,\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getReadingYears = () => {\n return fetch(\'/api/books/years\', {\n "method": "GET",\n "headers": {\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getBooksPerYearPerGenres = year => {\n return fetch(\'/api/books/genres\', {\n "method": "GET",\n "headers": {\n "year": year,\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getGenresCount = year => {\n return fetch(\'/api/books/genres/count\', {\n "method": "GET",\n "headers": {\n "year": year,\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getAvgRatings = year => {\n return fetch(\'/api/books/ratings\', {\n "method": "GET",\n "headers": {\n "year": year,\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getRatingsCount = year => {\n return fetch(\'/api/books/ratings/count\', {\n "method": "GET",\n "headers": {\n "year": year,\n "Authorization": "Bearer " + localStorage.getItem("token"),\n "userid": localStorage.getItem(\'id\')\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\n\n//# sourceURL=webpack://frontend/./src/components/Data.js?')}}]);