1 line
6.5 KiB
JSON
1 line
6.5 KiB
JSON
|
{"ast":null,"code":"var _jsxFileName = \"/Users/shoofle/Projects/the-forest/src/App.js\";\nimport client from 'libsql';\nimport logo from './logo.svg';\nimport './App.css';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst url = \"http://127.0.0.1:8000\";\nfunction getCount() {\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n statements: ['SELECT count(*) FROM pages']\n })\n }).then(res => res.json()).then(data => requestOneOf(data[0].results.rows[0][0])).catch(err => console.log(err));\n}\nfunction requestOneOf(maximum) {\n const id_we_want = Math.floor(Math.random() * maximum) + 1;\n fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n statements: [{\n q: 'select * from pages where id=@val',\n params: {\n 'val': id_we_want\n }\n }]\n })\n });\n}\nfunction App() {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"App\",\n children: /*#__PURE__*/_jsxDEV(\"header\", {\n className: \"App-header\",\n children: [/*#__PURE__*/_jsxDEV(\"img\", {\n src: logo,\n className: \"App-logo\",\n alt: \"logo\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 39,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"p\", {\n children: [\"Edit \", /*#__PURE__*/_jsxDEV(\"code\", {\n children: \"src/App.js\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 41,\n columnNumber: 16\n }, this), \" and save to reload.\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 40,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"a\", {\n className: \"App-link\",\n href: \"/\",\n children: \"Go to here!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 43,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n children: /*#__PURE__*/_jsxDEV(\"h3\", {\n children: \"Welcome to the forest!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 49,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 48,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 38,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 37,\n columnNumber: 5\n }, this);\n}\n_c = App;\nexport default App;\nvar _c;\n$RefreshReg$(_c, \"App\");","map":{"version":3,"names":["client","logo","jsxDEV","_jsxDEV","url","getCount","fetch","method","headers","body","JSON","stringify","statements","then","res","json","data","requestOneOf","results","rows","catch","err","console","log","maximum","id_we_want","Math","floor","random","q","params","App","className","children","src","alt","fileName","_jsxFileName","lineNumber","columnNumber","href","_c","$RefreshReg$"],"sources":["/Users/shoofle/Projects/the-forest/src/App.js"],"sourcesContent":["import client from 'libsql'\nimport logo from './logo.svg';\nimport './App.css';\n\nconst url = \"http://127.0.0.1:8000\"\n\nfunction getCount() {\n fetch(url, {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify({\n statements: ['SELECT count(*) FROM pages'],\n }),\n })\n .then((res) => res.json())\n .then((data) => requestOneOf(data[0].results.rows[0][0]))\n .catch((err) => console.log(err)); \n}\n\nfunction requestOneOf(maximum) {\n const id_we_want = Math.floor(Math.random() * maximum) + 1\n\n fetch(url, {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify({\n statements: [{\n q: 'select * from pages where id=@val',\n params: {'val': id_we_want}\n }]\n })\n })\n}\n\nf
|