{"version":3,"sources":["Pages/Login.js","../../modules/BrowserRouter.js","../../modules/HashRouter.js","../../modules/utils/locationUtils.js","../../modules/Link.js","../../modules/NavLink.js","services/auth.service.js","services/user.service.js","services/elearning.service.js","actions/auth.actions.js","actions/user.actions.js","actions/elearning.actions.js"],"names":["Login","useState","error","setError","dispatch","useDispatch","isAuthenticating","useSelector","state","auth","authenticating","message","membershipExpired","useEffect","formik","useFormik","initialValues","username","password","validationSchema","object","string","required","email","onSubmit","values","authActions","login","logout","to","duration","delay","className","distance","bottom","handleSubmit","htmlFor","id","touched","errors","name","type","autoComplete","value","onBlur","handleBlur","onChange","handleChange","xlinkHref","React","Component","resolveToLocation","currentLocation","normalizeToLocation","createLocation","forwardRefShim","C","forwardRef","LinkAnchor","innerRef","navigate","onClick","rest","target","props","event","ex","isModifiedEvent","forwardedRef","Link","component","replace","RouterContext","context","history","location","href","method","ariaCurrent","activeClassName","activeStyle","classNameProp","exact","isActiveProp","isActive","locationProp","sensitive","strict","styleProp","style","toLocation","path","escapedPath","match","matchPath","classnames","i","joinClassnames","authService","credentials","axios","post","process","userService","user","get","params","elearningService","courseCode","data","failure","authConstants","LOGIN_FAILURE","LOGIN_REQUEST","then","res","token","localStorage","setItem","JSON","stringify","LOGIN_SUCCESS","success","userConstants","SET_USER","setUser","catch","err","removeItem","LOGOUT","userActions","checkRegistration","CHECK_REGISTRATION_REQUEST","request","registered","CHECK_REGISTRATION_SUCCESS","CHECK_REGISTRATION_FAILURE","register","REGISTER_FAILURE","REGISTER_REQUEST","REGISTER_SUCCESS","sendPasswordReset","SEND_PASSWORD_RESET_REQUEST","SEND_PASSWORD_RESET_SUCCESS","SEND_PASSWORD_RESET_FAILURE","resetPassword","PASSWORD_RESET_FAILURE","PASSWORD_RESET_REQUEST","successful","PASSWORD_RESET_SUCCESS","elearningActions","fetchData","elearningConstants","FETCH_DATA_REQUEST","requiresAuth","FETCH_DATA_SUCCESS","response","status","statusText","FETCH_DATA_FAILURE","updateCoursePrepData","U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SAAAC,GAAQ,IAAD,EACoBA,EAAIN,KAA3BA,EADG,EACHA,KADG,EACG6C,aAEZhF,IAAQH,QAAQ,UAGlBnE,EAZU,SAACyG,GAAD,MAAW,CAAEpE,KAAM+G,IAAmBU,gCAAiCrD,QAYxEa,CAAQb,OAElBiB,OAAM,SAAAC,GAbK,IAAC7H,EAcXE,GAdWF,EAcM6H,EAdK,CAAEtF,KAAM+G,IAAmBW,gCAAiCjK,gBAgDxFkK,eA7BqB,SAACxD,GAKtB,OAAO,SAAAxG,GACLA,EALqB,CAAEqC,KAAM+G,IAAmBa,0BAMhD1D,EAAgCC,GAC7BM,MAAK,SAAAC,GAAQ,IAAD,EACgCA,EAAIN,KAAvCuC,EADG,EACHA,WAAYvC,EADT,EACSA,KADT,EACe6C,aAExBhF,IAAQH,QAAQ,WAIlBnE,EAbU,SAACyG,GAAD,MAAW,CAAEpE,KAAM+G,IAAmBc,wBAAyBzD,QAahEa,CAAQb,IACbuC,GACF1E,IAAQH,QAAQ,SAGnBuD,OAAM,SAAAC,GAjBK,IAAC7H,EAkBXE,GAlBWF,EAkBM6H,EAlBK,CAAEtF,KAAM+G,IAAmBe,wBAAyBrK","file":"static/js/17.df245807.chunk.js","sourcesContent":["import React, { useEffect, useState } from 'react';\r\nimport { Link, Redirect } from 'react-router-dom';\r\nimport { useDispatch, useSelector } from 'react-redux';\r\nimport Fade from 'react-reveal/Fade';\r\n\r\nimport { useFormik } from 'formik';\r\nimport { string, object } from 'yup';\r\n\r\nimport { authActions } from '../actions';\r\n\r\nimport HeaderAccount from '../components/HeaderAccount/HeaderAccount';\r\n\r\nimport '../App.scss';\r\nimport '../Styles/Account/Account.scss';\r\nimport '../Styles/Forms.scss';\r\n\r\nconst Login = () => {\r\n const [error, setError] = useState();\r\n\r\n const dispatch = useDispatch();\r\n const isAuthenticating = useSelector(state => state.auth.authenticating);\r\n const message = useSelector(state => state.auth.message);\r\n const membershipExpired = useSelector(state => state.auth.membershipExpired);\r\n\r\n useEffect(() => {\r\n if (!!message) {\r\n setError(message);\r\n }\r\n }, [message]);\r\n\r\n const formik = useFormik({\r\n initialValues: {\r\n username: \"\",\r\n password: \"\"\r\n },\r\n validationSchema: object({\r\n username: string()\r\n .required(\"Email address is required\")\r\n .email(\"Email address is invalid\"),\r\n password: string()\r\n .required(\"Password is required\")\r\n }),\r\n onSubmit: values => {\r\n dispatch(authActions.login(values.username, values.password));\r\n }\r\n });\r\n\r\n useEffect(() => {\r\n dispatch(authActions.logout());\r\n }, [dispatch]);\r\n\r\n if (membershipExpired) {\r\n return <Redirect to=\"/expired-membership\" />\r\n }\r\n\r\n return (\r\n <Fade duration={1000} delay={300}>\r\n <div className=\"l_account account--credentials\">\r\n\r\n <HeaderAccount />\r\n\r\n <div className=\"l_account-left\">\r\n <div className=\"account__header\">\r\n <Fade delay={400} duration={600} distance={'30px'} bottom >\r\n <div>\r\n <h1 className=\"account__title h1\">\r\n Welcome back to your virtual learning dashboard\r\n </h1>\r\n <p>\r\n Login to complete your course preparation, begin your course and access the continuous learning material.\r\n </p>\r\n </div>\r\n </Fade>\r\n </div>\r\n <div className=\"col-height\"></div>\r\n </div>\r\n <div className=\"l_account-right\">\r\n <Fade delay={700} duration={600} distance={'30px'} bottom>\r\n <form className=\"form\" onSubmit={formik.handleSubmit}>\r\n\r\n <h2 className=\"h3\">\r\n Login\r\n </h2>\r\n\r\n <div className=\"form__group\">\r\n <label className=\"form__label\" htmlFor=\"email\">Email Address</label>\r\n {/* Add class 'is-error' to input when in error state */}\r\n <input\r\n id=\"email\"\r\n className={`form__control\r\n ${formik.touched.username && formik.errors.username ? \"is-error\" : \"\"}`}\r\n name=\"username\"\r\n type=\"text\"\r\n autoComplete=\"off\"\r\n value={formik.values.username}\r\n onBlur={formik.handleBlur}\r\n onChange={formik.handleChange}\r\n />\r\n {\r\n formik.touched.username && formik.errors.username &&\r\n <div className=\"form__group__error\">\r\n {formik.errors.username}\r\n </div>\r\n }\r\n </div>\r\n\r\n <div className=\"form__group\">\r\n <label className=\"form__label\" htmlFor=\"password\">Password</label>\r\n {/* Add class 'is-error' to input when in error state */}\r\n <input\r\n id=\"password\"\r\n className={`form__control\r\n ${formik.touched.password && formik.errors.password ? \"is-error\" : \"\"}`}\r\n name=\"password\"\r\n type=\"password\"\r\n value={formik.values.password}\r\n onBlur={formik.handleBlur}\r\n onChange={formik.handleChange}\r\n />\r\n {\r\n formik.touched.password && formik.errors.password &&\r\n <div className=\"form__group__error\">\r\n {formik.errors.password}\r\n </div>\r\n }\r\n </div>\r\n\r\n <div className=\"forgot-password-cta\">\r\n <Link to=\"/forgot-password\">Forgot password?</Link>\r\n </div>\r\n\r\n {/* Add class 'is-loading' to button when submitting */}\r\n <button\r\n type=\"submit\"\r\n className={`button button--primary-arrow ${isAuthenticating ? \"is-loading\" : \"\"}`}\r\n >\r\n <span className=\"button__text\">Login</span>\r\n <span className=\"button__icon\">\r\n <svg className=\"icon-arrow-solid\">\r\n <use xlinkHref=\"#icon-arrow-solid\">\r\n </use>\r\n </svg>\r\n </span>\r\n <span className=\"button__loader\">\r\n </span>\r\n </button>\r\n <div className=\"form__error-container\">\r\n {\r\n !!error &&\r\n <span className=\"form__error\">\r\n {error}\r\n </span>\r\n }\r\n </div>\r\n </form>\r\n </Fade>\r\n\r\n <div className=\"col-height\"></div>\r\n </div>\r\n </div >\r\n </Fade>\r\n\r\n );\r\n}\r\n\r\nexport default Login;\r\n","import React from \"react\";\nimport { Router } from \"react-router\";\nimport { createBrowserHistory as createHistory } from \"history\";\nimport PropTypes from \"prop-types\";\nimport warning from \"tiny-warning\";\n\n/**\n * The public API for a <Router> that uses HTML5 history.\n */\nclass BrowserRouter extends React.Component {\n history = createHistory(this.props);\n\n render() {\n return <Router history={this.history} children={this.props.children} />;\n }\n}\n\nif (__DEV__) {\n BrowserRouter.propTypes = {\n basename: PropTypes.string,\n children: PropTypes.node,\n forceRefresh: PropTypes.bool,\n getUserConfirmation: PropTypes.func,\n keyLength: PropTypes.number\n };\n\n BrowserRouter.prototype.componentDidMount = function() {\n warning(\n !this.props.history,\n \"<BrowserRouter> ignores the history prop. To use a custom history, \" +\n \"use `import { Router }` instead of `import { BrowserRouter as Router }`.\"\n );\n };\n}\n\nexport default BrowserRouter;\n","import React from \"react\";\nimport { Router } from \"react-router\";\nimport { createHashHistory as createHistory } from \"history\";\nimport PropTypes from \"prop-types\";\nimport warning from \"tiny-warning\";\n\n/**\n * The public API for a <Router> that uses window.location.hash.\n */\nclass HashRouter extends React.Component {\n history = createHistory(this.props);\n\n render() {\n return <Router history={this.history} children={this.props.children} />;\n }\n}\n\nif (__DEV__) {\n HashRouter.propTypes = {\n basename: PropTypes.string,\n children: PropTypes.node,\n getUserConfirmation: PropTypes.func,\n hashType: PropTypes.oneOf([\"hashbang\", \"noslash\", \"slash\"])\n };\n\n HashRouter.prototype.componentDidMount = function() {\n warning(\n !this.props.history,\n \"<HashRouter> ignores the history prop. To use a custom history, \" +\n \"use `import { Router }` instead of `import { HashRouter as Router }`.\"\n );\n };\n}\n\nexport default HashRouter;\n","import { createLocation } from \"history\";\n\nexport const resolveToLocation = (to, currentLocation) =>\n typeof to === \"function\" ? to(currentLocation) : to;\n\nexport const normalizeToLocation = (to, currentLocation) => {\n return typeof to === \"string\"\n ? createLocation(to, null, null, currentLocation)\n : to;\n};\n","import React from \"react\";\nimport { __RouterContext as RouterContext } from \"react-router\";\nimport PropTypes from \"prop-types\";\nimport invariant from \"tiny-invariant\";\nimport {\n resolveToLocation,\n normalizeToLocation\n} from \"./utils/locationUtils.js\";\n\n// React 15 compat\nconst forwardRefShim = C => C;\nlet { forwardRef } = React;\nif (typeof forwardRef === \"undefined\") {\n forwardRef = forwardRefShim;\n}\n\nfunction isModifiedEvent(event) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nconst LinkAnchor = forwardRef(\n (\n {\n innerRef, // TODO: deprecate\n navigate,\n onClick,\n ...rest\n },\n forwardedRef\n ) => {\n const { target } = rest;\n\n let props = {\n ...rest,\n onClick: event => {\n try {\n if (onClick) onClick(event);\n } catch (ex) {\n event.preventDefault();\n throw ex;\n }\n\n if (\n !event.defaultPrevented && // onClick prevented default\n event.button === 0 && // ignore everything but left clicks\n (!target || target === \"_self\") && // let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // ignore clicks with modifier keys\n ) {\n event.preventDefault();\n navigate();\n }\n }\n };\n\n // React 15 compat\n if (forwardRefShim !== forwardRef) {\n props.ref = forwardedRef || innerRef;\n } else {\n props.ref = innerRef;\n }\n\n /* eslint-disable-next-line jsx-a11y/anchor-has-content */\n return <a {...props} />;\n }\n);\n\nif (__DEV__) {\n LinkAnchor.displayName = \"LinkAnchor\";\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nconst Link = forwardRef(\n (\n {\n component = LinkAnchor,\n replace,\n to,\n innerRef, // TODO: deprecate\n ...rest\n },\n forwardedRef\n ) => {\n return (\n <RouterContext.Consumer>\n {context => {\n invariant(context, \"You should not use <Link> outside a <Router>\");\n\n const { history } = context;\n\n const location = normalizeToLocation(\n resolveToLocation(to, context.location),\n context.location\n );\n\n const href = location ? history.createHref(location) : \"\";\n const props = {\n ...rest,\n href,\n navigate() {\n const location = resolveToLocation(to, context.location);\n const method = replace ? history.replace : history.push;\n\n method(location);\n }\n };\n\n // React 15 compat\n if (forwardRefShim !== forwardRef) {\n props.ref = forwardedRef || innerRef;\n } else {\n props.innerRef = innerRef;\n }\n\n return React.createElement(component, props);\n }}\n </RouterContext.Consumer>\n );\n }\n);\n\nif (__DEV__) {\n const toType = PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.object,\n PropTypes.func\n ]);\n const refType = PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.any })\n ]);\n\n Link.displayName = \"Link\";\n\n Link.propTypes = {\n innerRef: refType,\n onClick: PropTypes.func,\n replace: PropTypes.bool,\n target: PropTypes.string,\n to: toType.isRequired\n };\n}\n\nexport default Link;\n","import React from \"react\";\nimport { __RouterContext as RouterContext, matchPath } from \"react-router\";\nimport PropTypes from \"prop-types\";\nimport invariant from \"tiny-invariant\";\nimport Link from \"./Link.js\";\nimport {\n resolveToLocation,\n normalizeToLocation\n} from \"./utils/locationUtils.js\";\n\n// React 15 compat\nconst forwardRefShim = C => C;\nlet { forwardRef } = React;\nif (typeof forwardRef === \"undefined\") {\n forwardRef = forwardRefShim;\n}\n\nfunction joinClassnames(...classnames) {\n return classnames.filter(i => i).join(\" \");\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nconst NavLink = forwardRef(\n (\n {\n \"aria-current\": ariaCurrent = \"page\",\n activeClassName = \"active\",\n activeStyle,\n className: classNameProp,\n exact,\n isActive: isActiveProp,\n location: locationProp,\n sensitive,\n strict,\n style: styleProp,\n to,\n innerRef, // TODO: deprecate\n ...rest\n },\n forwardedRef\n ) => {\n return (\n <RouterContext.Consumer>\n {context => {\n invariant(context, \"You should not use <NavLink> outside a <Router>\");\n\n const currentLocation = locationProp || context.location;\n const toLocation = normalizeToLocation(\n resolveToLocation(to, currentLocation),\n currentLocation\n );\n const { pathname: path } = toLocation;\n // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202\n const escapedPath =\n path && path.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n\n const match = escapedPath\n ? matchPath(currentLocation.pathname, {\n path: escapedPath,\n exact,\n sensitive,\n strict\n })\n : null;\n const isActive = !!(isActiveProp\n ? isActiveProp(match, currentLocation)\n : match);\n\n const className = isActive\n ? joinClassnames(classNameProp, activeClassName)\n : classNameProp;\n const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;\n\n const props = {\n \"aria-current\": (isActive && ariaCurrent) || null,\n className,\n style,\n to: toLocation,\n ...rest\n };\n\n // React 15 compat\n if (forwardRefShim !== forwardRef) {\n props.ref = forwardedRef || innerRef;\n } else {\n props.innerRef = innerRef;\n }\n\n return <Link {...props} />;\n }}\n </RouterContext.Consumer>\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n\n const ariaCurrentType = PropTypes.oneOf([\n \"page\",\n \"step\",\n \"location\",\n \"date\",\n \"time\",\n \"true\"\n ]);\n\n NavLink.propTypes = {\n ...Link.propTypes,\n \"aria-current\": ariaCurrentType,\n activeClassName: PropTypes.string,\n activeStyle: PropTypes.object,\n className: PropTypes.string,\n exact: PropTypes.bool,\n isActive: PropTypes.func,\n location: PropTypes.object,\n sensitive: PropTypes.bool,\n strict: PropTypes.bool,\n style: PropTypes.object\n };\n}\n\nexport default NavLink;\n","import axios from 'axios';\r\n\r\nconst login = (credentials) => {\r\n return axios.post(\r\n `${process.env.REACT_APP_API_URL}/api/authentication/authenticate`,\r\n {\r\n email: credentials.username,\r\n password: credentials.password\r\n }\r\n );\r\n}\r\n\r\nconst logout = () => {\r\n return axios.post(\r\n `${process.env.REACT_APP_API_URL}/api/authentication/logout`\r\n );\r\n}\r\n\r\nexport const authService = {\r\n login,\r\n logout\r\n}\r\n","import axios from 'axios';\r\n\r\nconst register = (user) => {\r\n return axios.post(\r\n `${process.env.REACT_APP_API_URL}/api/user/register`,\r\n {\r\n email: user.email,\r\n password: user.password\r\n }\r\n );\r\n}\r\n\r\nconst checkRegistration = (user) => {\r\n return axios.get(\r\n `${process.env.REACT_APP_API_URL}/api/user/isregistered`,\r\n {\r\n params: {\r\n email: user.email\r\n }\r\n }\r\n );\r\n}\r\n\r\nconst sendPasswordReset = (email) => {\r\n return axios.post(\r\n `${process.env.REACT_APP_API_URL}/api/user/resetpasswordrequest`,\r\n null,\r\n {\r\n params: {\r\n email\r\n }\r\n }\r\n );\r\n}\r\n\r\nconst resetPassword = (user) => {\r\n return axios.post(\r\n `${process.env.REACT_APP_API_URL}/api/user/resetpassword`,\r\n user\r\n );\r\n}\r\n\r\nexport const userService = {\r\n checkRegistration,\r\n register,\r\n sendPasswordReset,\r\n resetPassword\r\n}\r\n","import axios from 'axios';\r\n\r\nconst fetchData = (courseCode) => {\r\n return axios.get(\r\n `${process.env.REACT_APP_API_URL}/api/elearningdata/getdata`,\r\n {\r\n params: {\r\n courseCode\r\n }\r\n }\r\n );\r\n}\r\n\r\nconst updateCoursePrepData = (data) => {\r\n return axios.post(\r\n `${process.env.REACT_APP_API_URL}/api/elearningdata/coursepreparationupdate`,\r\n data\r\n );\r\n}\r\n\r\nconst completeCourse = (courseCode) => {\r\n return axios.post(\r\n `${process.env.REACT_APP_API_URL}/api/elearningdata/completecourse`,\r\n {\r\n courseCode\r\n }\r\n );\r\n}\r\n\r\nexport const elearningService = {\r\n fetchData,\r\n updateCoursePrepData,\r\n completeCourse\r\n}\r\n","import { authConstants, userConstants } from '../constants';\r\nimport { authService } from '../services';\r\n\r\nimport { history } from '../helpers';\r\n\r\nconst login = (username, password) => {\r\n const request = () => ({ type: authConstants.LOGIN_REQUEST });\r\n const success = (user) => ({ type: authConstants.LOGIN_SUCCESS, user });\r\n const failure = (error) => ({ type: authConstants.LOGIN_FAILURE, error });\r\n\r\n const setUser = (user) => ({ type: userConstants.SET_USER, user });\r\n\r\n return dispatch => {\r\n dispatch(request())\r\n authService.login({ username, password })\r\n .then(res => {\r\n const { data: token, courseCode, message, membershipExpired } = res.data;\r\n if (!!token ) {\r\n const user = { token, courseCode };\r\n localStorage.setItem('currentUser', JSON.stringify(user));\r\n dispatch(success(user));\r\n dispatch(setUser(user));\r\n history.replace(\"/\");\r\n }\r\n else {\r\n dispatch(failure({\r\n membershipExpired,\r\n message\r\n }));\r\n }\r\n })\r\n .catch(err => {\r\n dispatch(failure(err));\r\n });\r\n }\r\n}\r\n\r\nconst logout = () => {\r\n const signout = () => ({ type: authConstants.LOGOUT });\r\n const setUser = (user) => ({ type: userConstants.SET_USER, user });\r\n\r\n return dispatch => {\r\n authService.logout()\r\n .then(res => {\r\n localStorage.removeItem('currentUser');\r\n dispatch(setUser({}));\r\n dispatch(signout());\r\n })\r\n .catch(err => {\r\n });\r\n }\r\n}\r\n\r\nexport const authActions = {\r\n login,\r\n logout\r\n}\r\n","import { userConstants } from '../constants';\r\nimport { userService } from '../services';\r\n\r\nimport { history } from '../helpers';\r\n\r\nconst register = (user) => {\r\n const request = (user) => ({ type: userConstants.REGISTER_REQUEST, user });\r\n const success = (user) => ({ type: userConstants.REGISTER_SUCCESS, user });\r\n const failure = (error) => ({ type: userConstants.REGISTER_FAILURE, error });\r\n const setUser = (user) => ({ type: userConstants.SET_USER, user });\r\n\r\n return dispatch => {\r\n dispatch(request(user));\r\n userService.register(user)\r\n .then(res => {\r\n const { data: token, courseCode, message } = res.data;\r\n if (!!token) {\r\n const user = { token, courseCode };\r\n localStorage.setItem('currentUser', JSON.stringify(user));\r\n dispatch(success(user))\r\n dispatch(setUser(user));\r\n history.replace(\"/\");\r\n }\r\n else {\r\n dispatch(failure({\r\n message \r\n }));\r\n }\r\n })\r\n .catch(err => {\r\n dispatch(failure(err));\r\n });\r\n }\r\n}\r\n\r\nconst checkRegistration = (user) => {\r\n const request = (user) => ({ type: userConstants.CHECK_REGISTRATION_REQUEST, user });\r\n const success = (registered) => ({ type: userConstants.CHECK_REGISTRATION_SUCCESS, registered });\r\n const failure = (error) => ({ type: userConstants.CHECK_REGISTRATION_FAILURE, error });\r\n\r\n return dispatch => {\r\n dispatch(request(user));\r\n userService.checkRegistration(user)\r\n .then(res => {\r\n const { data: registered } = res.data;\r\n dispatch(success(registered));\r\n })\r\n .catch(err => {\r\n dispatch(failure(err));\r\n });\r\n }\r\n}\r\n\r\nconst sendPasswordReset = (email) => {\r\n const request = (email) => ({ type: userConstants.SEND_PASSWORD_RESET_REQUEST, email });\r\n const success = () => ({ type: userConstants.SEND_PASSWORD_RESET_SUCCESS });\r\n const failure = (error) => ({ type: userConstants.SEND_PASSWORD_RESET_FAILURE, error });\r\n\r\n return dispatch => {\r\n dispatch(request(email));\r\n userService.sendPasswordReset(email)\r\n .then(res => {\r\n const { data } = res.data;\r\n dispatch(success());\r\n })\r\n .catch(err => {\r\n dispatch(failure(err));\r\n });\r\n }\r\n}\r\n\r\nconst resetPassword = (user) => {\r\n const request = () => ({ type: userConstants.PASSWORD_RESET_REQUEST });\r\n const success = () => ({ type: userConstants.PASSWORD_RESET_SUCCESS });\r\n const failure = (error) => ({ type: userConstants.PASSWORD_RESET_FAILURE, error });\r\n\r\n return dispatch => {\r\n dispatch(request());\r\n userService.resetPassword(user)\r\n .then(res => {\r\n const { successful, message } = res.data;\r\n if (successful) {\r\n dispatch(success());\r\n history.replace(\"/resetmessage\");\r\n }\r\n else {\r\n dispatch(failure({\r\n message\r\n }));\r\n }\r\n })\r\n .catch(err => {\r\n dispatch(failure(err));\r\n });\r\n }\r\n}\r\n\r\nexport const userActions = {\r\n checkRegistration,\r\n register,\r\n sendPasswordReset,\r\n resetPassword\r\n}\r\n","import { elearningConstants } from '../constants';\r\nimport { elearningService } from '../services';\r\n\r\nimport { history } from '../helpers';\r\n\r\nconst fetchData = (courseCode) => {\r\n const request = () => ({ type: elearningConstants.FETCH_DATA_REQUEST });\r\n const success = (data) => ({ type: elearningConstants.FETCH_DATA_SUCCESS, data });\r\n const failure = (error) => ({ type: elearningConstants.FETCH_DATA_FAILURE, error });\r\n\r\n return dispatch => {\r\n dispatch(request());\r\n elearningService.fetchData(courseCode)\r\n .then(res => {\r\n const { data, requiresAuth } = res.data;\r\n if (requiresAuth) {\r\n history.replace(\"/login\")\r\n return;\r\n }\r\n dispatch(success(data));\r\n })\r\n .catch(err => {\r\n const { status, statusText } = err.response;\r\n dispatch(failure({ status, statusText }));\r\n });\r\n }\r\n}\r\n\r\nconst updateCoursePrepData = (data) => {\r\n const request = () => ({ type: elearningConstants.UPDATE_COURSE_PREP_DATA_REQUEST });\r\n const success = (data) => ({ type: elearningConstants.UPDATE_COURSE_PREP_DATA_SUCCESS, data });\r\n const failure = (error) => ({ type: elearningConstants.UPDATE_COURSE_PREP_DATA_FAILURE, error });\r\n\r\n return dispatch => {\r\n dispatch(request());\r\n elearningService.updateCoursePrepData(data)\r\n .then(res => {\r\n const { data, requiresAuth } = res.data;\r\n if (requiresAuth) {\r\n history.replace(\"/login\")\r\n return;\r\n }\r\n dispatch(success(data));\r\n })\r\n .catch(err => {\r\n dispatch(failure(err));\r\n });\r\n }\r\n}\r\n\r\nconst completeCourse = (courseCode) => {\r\n const request = () => ({ type: elearningConstants.COMPLETE_COURSE_REQUEST });\r\n const success = (data) => ({ type: elearningConstants.COMPLETE_COURSE_SUCCESS, data });\r\n const failure = (error) => ({ type: elearningConstants.COMPLETE_COURSE_FAILURE, error });\r\n\r\n return dispatch => {\r\n dispatch(request());\r\n elearningService.completeCourse(courseCode)\r\n .then(res => {\r\n const { successful, data, requiresAuth } = res.data;\r\n if (requiresAuth) {\r\n history.replace(\"/login\")\r\n return;\r\n }\r\n\r\n dispatch(success(data));\r\n if (successful) {\r\n history.replace(\"/\")\r\n }\r\n })\r\n .catch(err => {\r\n dispatch(failure(err));\r\n });\r\n }\r\n}\r\n\r\nexport const elearningActions = {\r\n fetchData,\r\n updateCoursePrepData,\r\n completeCourse\r\n}\r\n"],"sourceRoot":""}