mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
18 KiB
JSON
1 line
18 KiB
JSON
|
{"ast":null,"code":"var _jsxFileName = \"/app/src/Pages/Reset.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useContext } from 'react';\nimport '../App.css';\nimport './Reset.css';\nimport { Button } from 'reactstrap';\nimport { Formik, Form, Field } from 'formik';\nimport ScaleLoader from 'react-spinners/ScaleLoader';\nimport { validateResetPassword, sendPasswordReset } from '../Api/index';\nimport AuthContext from '../Contexts/AuthContext';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Reset = route => {\n _s();\n\n let boolTrue = true;\n const [loading, setLoading] = useState(true);\n const [reset, setReset] = useState({});\n const [sent, setSent] = useState(false);\n let {\n ResetPassword\n } = useContext(AuthContext);\n let reqToken = false;\n\n if (route && route.match && route.match.params && route.match.params.token) {\n reqToken = route.match.params.token;\n }\n\n const sendReset = values => {\n sendPasswordReset(values).then(() => {\n setSent(true);\n });\n };\n\n useEffect(() => {\n if (!reqToken) {\n setLoading(false);\n return false;\n }\n\n validateResetPassword(reqToken).then(data => {\n setReset(data);\n setLoading(false);\n });\n }, [reqToken]);\n\n if (loading) {\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: 45,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 44,\n columnNumber: 7\n }, this);\n }\n\n if (sent) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: /*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Check your email!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 7\n }, this);\n }\n\n if (!reqToken) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Reset Password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageBody\",\n children: /*#__PURE__*/_jsxDEV(Formik, {\n initialValues: {\n email: ''\n },\n onSubmit: values => sendReset(values),\n children: /*#__PURE__*/_jsxDEV(Form, {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 20\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"email\",\n type: \"email\",\n required: boolTrue,\n className: \"loginFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 18\n }, this), /*#__PURE__*/_jsxDEV(Button, {\n color: \"primary\",\n type: \"submit\",\n className: \"loginButton\",\n disabled: loading,\n children: loading ? /
|