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

2 lines
5.2 KiB
JavaScript
Raw Normal View History

/*! For license information please see src_components_Data_js.js.LICENSE.txt */
2023-07-28 17:23:14 +02:00
"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([["src_components_Data_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 */ "getBooksByYear": () => (/* binding */ getBooksByYear),\n/* harmony export */ "getBooksPerYearPerGenres": () => (/* binding */ getBooksPerYearPerGenres),\n/* harmony export */ "getChallenge": () => (/* binding */ getChallenge),\n/* harmony export */ "getCountries": () => (/* binding */ getCountries),\n/* harmony export */ "getGenresCount": () => (/* binding */ getGenresCount),\n/* harmony export */ "getRatingsCount": () => (/* binding */ getRatingsCount),\n/* harmony export */ "getReadingYears": () => (/* binding */ getReadingYears),\n/* harmony export */ "getShortestLongestBook": () => (/* binding */ getShortestLongestBook),\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 }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getBooksByYear = year => {\n return fetch(\'/api/books\', {\n "method": "GET",\n "headers": {\n "year": year\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 }).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 }\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 }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getReadingYears = () => {\n return fetch(\'/api/books/years\', {\n "method": "GET"\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getCountries = year => {\n return fetch(\'/api/books/countries\', {\n "method": "GET",\n "headers": {\n "year": year\n }\n }).then(response => response.json()).then(data => {\n return data;\n });\n};\nconst getShortestLongestBook = year => {\n return fetch(\'/api/books/pages/stats\', {\n "method": "GET",\n