GoScrobble/web/node_modules/.cache/babel-loader/25f74c3465109b3435b9f94f656ef38d.json

1 line
14 KiB
JSON
Raw Normal View History

2022-04-25 02:47:15 +00:00
{"ast":null,"code":"var _jsxFileName = \"/app/src/Pages/Register.js\",\n _s = $RefreshSig$();\n\nimport React, { useContext, useState, useEffect } from 'react';\nimport '../App.css';\nimport './Register.css';\nimport { Button } from 'reactstrap';\nimport ScaleLoader from \"react-spinners/ScaleLoader\";\nimport AuthContext from '../Contexts/AuthContext';\nimport { Formik, Field, Form } from 'formik';\nimport { useHistory } from 'react-router';\nimport { getServerInfo } from '../Api/index';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Register = () => {\n _s();\n\n const history = useHistory();\n let boolTrue = true;\n let {\n Register,\n user,\n loading\n } = useContext(AuthContext);\n let [serverInfo, setServerInfo] = useState({\n registration_enabled: true\n });\n let [isLoading, setIsLoading] = useState(true);\n useEffect(() => {\n if (user) {\n return;\n }\n\n getServerInfo().then(data => {\n setServerInfo(data);\n setIsLoading(false);\n });\n }, [user]);\n\n if (isLoading) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: /*#__PURE__*/_jsxDEV(ScaleLoader, {\n color: \"#6AD7E5\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 31,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 30,\n columnNumber: 7\n }, this);\n }\n\n if (user) {\n history.push(\"/dashboard\");\n }\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: serverInfo.registration_enabled !== \"1\" ? /*#__PURE__*/_jsxDEV(\"p\", {\n children: \"Registration is temporarily disabled. Please try again soon!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 44,\n columnNumber: 9\n }, this) : /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Register\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 47,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageBody\",\n children: /*#__PURE__*/_jsxDEV(Formik, {\n initialValues: {\n username: '',\n email: '',\n password: '',\n passwordconfirm: ''\n },\n onSubmit: async values => Register(values),\n children: /*#__PURE__*/_jsxDEV(Form, {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Username\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 27\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"username\",\n type: \"text\",\n required: boolTrue,\n className: \"registerFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 19\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 56,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 24\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"email\",\n type: \"email\",\n required: boolTrue,\n className: \"registerFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 19\n }, this)]\n