tethysfaceid
Version:
1 lines • 4.15 kB
JSON
{"ast":null,"code":"import { jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Col, Row, Carousel, Card, Divider, Alert, Button, Modal, message } from 'antd';\nimport { handleError } from 'common/utils';\nimport LogInComponent from 'components/LogInForm/logInComponent';\nimport { logInUser } from 'components/LogInForm/loginServices';\nimport UserStatus from 'components/Status/userStatus';\nimport TermsAndConditions from 'components/TermsAndConditionsForm/TermsAndConditions';\nimport Image from 'next/image';\nimport { useEffect, useRef, useState } from 'react';\n\nconst LogInCarousel = props => {\n const {\n 0: loading,\n 1: setLoading\n } = useState(false);\n const {\n 0: data,\n 1: setData\n } = useState(null);\n const {\n 0: userStatus,\n 1: setUserStatus\n } = useState(false);\n const carousel = useRef(null);\n\n const onClickNext = () => {\n carousel.current.next();\n };\n\n const onClickPrev = () => {\n carousel.current.prev();\n };\n\n const onSubmitLogIn = values => {\n setLoading(true);\n logInUser(_objectSpread({}, values)).then(({\n data\n }) => {\n const {\n statusCodeValue,\n body\n } = data;\n setData(body);\n console.log(body);\n\n if (statusCodeValue === 202) {\n message.success('Authentication Successfull');\n onClickNext();\n } else {\n Modal.error({\n content: body\n });\n }\n }).catch(handleError).finally(() => setLoading(false));\n };\n\n useEffect(() => {\n if (userStatus === 'Matched') {\n onClickNext();\n } else if (userStatus === 'NotMatched') {\n onClickNext();\n }\n }, [userStatus]);\n return /*#__PURE__*/_jsx(Row, {\n style: {\n minHeight: '100vh'\n },\n className: \"padding-left-2x-mobile padding-right-2x-mobile secondary-bg light primary\",\n children: /*#__PURE__*/_jsxs(Col, {\n xxl: 8,\n xl: 8,\n md: 14,\n sm: 24,\n xs: 24,\n className: \"mx-auto margin-top-5x\",\n children: [/*#__PURE__*/_jsx(Card, {\n children: /*#__PURE__*/_jsx(\"div\", {\n className: \"center \",\n children: /*#__PURE__*/_jsx(Image, {\n src: \"/logo.jpg\",\n alt: \"Tethys\",\n width: \"150\",\n height: \"50\"\n })\n })\n }), /*#__PURE__*/_jsxs(Carousel, {\n dotPosition: \"bottom\",\n ref: carousel,\n dots: false,\n touchMove: false,\n swipeToSlide: false,\n children: [/*#__PURE__*/_jsx(LogInComponent, {\n onLogIn: onSubmitLogIn,\n loading: loading\n }), data && /*#__PURE__*/_jsx(TermsAndConditions, {\n data: data,\n onContinue: setUserStatus\n }), /*#__PURE__*/_jsx(UserStatus, {\n data: data,\n status: userStatus\n })]\n })]\n })\n });\n};\n\nexport default LogInCarousel;","map":null,"metadata":{},"sourceType":"module"}