1 line
21 KiB
JSON
1 line
21 KiB
JSON
|
{"ast":null,"code":"import _regeneratorRuntime from \"/home/vagrant/Gazebo_simulation-Frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/regenerator\";\nimport _asyncToGenerator from \"/home/vagrant/Gazebo_simulation-Frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator\";\nimport _classCallCheck from \"/home/vagrant/Gazebo_simulation-Frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"/home/vagrant/Gazebo_simulation-Frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"/home/vagrant/Gazebo_simulation-Frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"/home/vagrant/Gazebo_simulation-Frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf\";\nimport _inherits from \"/home/vagrant/Gazebo_simulation-Frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits\";\nvar _jsxFileName = \"/home/vagrant/Gazebo_simulation-Frontend/src/components/TaskList.js\";\nimport React, { Component } from 'react';\nimport { Button, ButtonGroup, Container, Table } from 'reactstrap';\nimport { Link, withRouter } from 'react-router-dom';\nimport { withCookies, Cookies } from 'react-cookie';\nimport { instanceOf } from 'prop-types';\nimport Navigationbar from './Navigationbar';\n\nvar TaskList = /*#__PURE__*/function (_Component) {\n _inherits(TaskList, _Component);\n\n function TaskList(props) {\n var _this;\n\n _classCallCheck(this, TaskList);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(TaskList).call(this, props));\n _this.state = {\n isLoading: true,\n isAuthenticated: false,\n user: undefined,\n simulator: undefined\n };\n var cookies = props.cookies;\n _this.state = {\n tasks: [],\n csrfToken: cookies.get('XSRF-TOKEN'),\n isLoading: true,\n simulator: \"\",\n timeoutActionTaken: false\n };\n _this.local = \"localhost:8080\";\n _this.prod = \"174.138.41.124:8080\";\n _this.status = \"local\";\n\n if (_this.status === \"local\") {\n _this.ip = _this.local;\n }\n\n _this.simulatorWindow = null;\n return _this;\n }\n\n _createClass(TaskList, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.loadUser();\n }\n }, {\n key: \"loadUser\",\n value: function () {\n var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n var _this2 = this;\n\n var response, body, userId, userName;\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return fetch(\"http://\".concat(this.ip, \"/api/user\"), {\n credentials: 'include'\n });\n\n case 2:\n response = _context.sent;\n _context.next = 5;\n return response.text();\n\n case 5:\n body = _context.sent;\n\n if (body === '') {\n this.setState({\n isAuthenticated: false\n });\n } else {\n this.setState({\n isAuthenticated: true,\n user: JSON.parse(body)\n });\n }\n\n console.log(\"())))))))))))))))))))))))))\");\n console.log(this.state.isAuthenticated);\n userId = this.state.user.sub;\n userName = this.state.user.given_name;\n fetch(\"http://\".concat(this.ip, \"/competition/progress/\").concat(userId, \"/13\"), {\n credentials: 'include'\n
|