mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
14 KiB
JSON
1 line
14 KiB
JSON
{"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 }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 27\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"password\",\n type: \"password\",\n required: boolTrue,\n className: \"registerFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 19\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm Password\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 35\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"passwordconfirm\",\n type: \"password\",\n required: boolTrue,\n className: \"registerFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 19\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 22\n }, this), /*#__PURE__*/_jsxDEV(Button, {\n color: \"primary\",\n type: \"submit\",\n className: \"registerButton\",\n disabled: loading,\n children: loading ? /*#__PURE__*/_jsxDEV(ScaleLoader, {\n color: \"#FFF\",\n size: 35\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 31\n }, this) : \"Register\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 55,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 50,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 46,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 41,\n columnNumber: 5\n }, this);\n};\n\n_s(Register, \"lnnkh39x2jK6CbzYmT01I8I7Cps=\", false, function () {\n return [useHistory];\n});\n\n_c = Register;\nexport default Register;\n\nvar _c;\n\n$RefreshReg$(_c, \"Register\");","map":{"version":3,"sources":["/app/src/Pages/Register.js"],"names":["React","useContext","useState","useEffect","Button","ScaleLoader","AuthContext","Formik","Field","Form","useHistory","getServerInfo","Register","history","boolTrue","user","loading","serverInfo","setServerInfo","registration_enabled","isLoading","setIsLoading","then","data","push","username","email","password","passwordconfirm","values"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,SAAtC,QAAuD,OAAvD;AACA,OAAO,YAAP;AACA,OAAO,gBAAP;AACA,SAASC,MAAT,QAAuB,YAAvB;AACA,OAAOC,WAAP,MAAwB,4BAAxB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,SAASC,MAAT,EAAiBC,KAAjB,EAAwBC,IAAxB,QAAoC,QAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,aAAT,QAA8B,cAA9B;;;AACA,MAAMC,QAAQ,GAAG,MAAM;AAAA;;AACrB,QAAMC,OAAO,GAAGH,UAAU,EAA1B;AACA,MAAII,QAAQ,GAAG,IAAf;AACA,MAAI;AAAEF,IAAAA,QAAF;AAAYG,IAAAA,IAAZ;AAAkBC,IAAAA;AAAlB,MAA8Bf,UAAU,CAACK,WAAD,CAA5C;AACA,MAAI,CAACW,UAAD,EAAaC,aAAb,IAA8BhB,QAAQ,CAAC;AAAEiB,IAAAA,oBAAoB,EAAE;AAAxB,GAAD,CAA1C;AACA,MAAI,CAACC,SAAD,EAAYC,YAAZ,IAA4BnB,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAA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,MAAnB;AAA0B,gBAAA,IAAI,EAAE;AAAhC;AAAA;AAAA;AAAA;AAAA,sBAAH,GAA4C;AALvD;AAAA;AAAA;AAAA;AAAA,oBAzCF;AAAA;AAAA;AAAA;AAAA;AAAA;AAJF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAJF;AAAA;AAAA;AAAA;AAAA;AAAA;AALJ;AAAA;AAAA;AAAA;AAAA,UADF;AAqED,CAnGD;;GAAMJ,Q;UACYF,U;;;KADZE,Q;AAqGN,eAAeA,QAAf","sourcesContent":["import 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';\nconst Register = () => {\n const history = useHistory();\n let boolTrue = true;\n let { Register, user, loading } = useContext(AuthContext);\n let [serverInfo, setServerInfo] = useState({ registration_enabled: true });\n let [isLoading, setIsLoading] = useState(true);\n\n useEffect(() => {\n if (user) {\n return\n }\n getServerInfo()\n .then(data => {\n setServerInfo(data);\n setIsLoading(false);\n })\n }, [user])\n\n if (isLoading) {\n return (\n <div className=\"pageWrapper\">\n <ScaleLoader color=\"#6AD7E5\" />\n </div>\n )\n }\n\n if (user) {\n history.push(\"/dashboard\");\n }\n\n return (\n <div className=\"pageWrapper\">\n {\n serverInfo.registration_enabled !== \"1\" ?\n <p>Registration is temporarily disabled. Please try again soon!</p>\n :\n <div>\n <h1>\n Register\n </h1>\n <div className=\"pageBody\">\n <Formik\n initialValues={{ username: '', email: '', password: '', passwordconfirm: '' }}\n onSubmit={async values => Register(values)}\n >\n <Form>\n <label>\n Username<br/>\n <Field\n name=\"username\"\n type=\"text\"\n required={boolTrue}\n className=\"registerFields\"\n />\n </label>\n <br/>\n <label>\n Email<br/>\n <Field\n name=\"email\"\n type=\"email\"\n required={boolTrue}\n className=\"registerFields\"\n />\n </label>\n <br/>\n <label>\n Password<br/>\n <Field\n name=\"password\"\n type=\"password\"\n required={boolTrue}\n className=\"registerFields\"\n />\n </label>\n <br/>\n <label>\n Confirm Password<br/>\n <Field\n name=\"passwordconfirm\"\n type=\"password\"\n required={boolTrue}\n className=\"registerFields\"\n />\n </label>\n <br/><br/>\n <Button\n color=\"primary\"\n type=\"submit\"\n className=\"registerButton\"\n disabled={loading}\n >{loading ? <ScaleLoader color=\"#FFF\" size={35} /> : \"Register\"}</Button>\n </Form>\n </Formik>\n </div>\n </div>\n }\n </div>\n );\n}\n\nexport default Register;\n"]},"metadata":{},"sourceType":"module"} |