c9b26a6ff2da984aa30f6a772ec89ca8.json
4.71 KB
{"ast":null,"code":"import { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nvar _jsxFileName = \"C:\\\\Users\\\\kkwan_000\\\\Desktop\\\\git\\\\2017110269\\\\minsung\\\\src\\\\Container\\\\Login.js\",\n _s = $RefreshSig$();\n\nimport React, { useState } from 'react';\nimport LoginForm from '../component/LoginForm';\nimport { getLoginInfo } from '../lib/api/login';\nimport { Redirect, withRouter } from \"react-router-dom\";\n\nconst fetchLogInfo = async data => {\n try {\n const result = await getLoginInfo(data);\n\n if (result.status === 200) {\n console.log(\"서버 데이터와 일치: \" + result.data); // result의 반환값 확인\n\n return true;\n }\n } catch (e) {\n console.log(e);\n alert(\"id와 비밀번호를 확인해주세요!\");\n return false;\n }\n};\n\nconst Login = () => {\n _s();\n\n const [authenticated, setAuthenticated] = useState(false);\n\n const onFinish = async values => {\n console.log('Received values of form: ', values);\n const isAuth = await fetchLogInfo(values);\n sessionStorage.setItem(\"isAuth\", isAuth); //세션 스토리지 저장\n\n sessionStorage.setItem(\"id\", values.userid);\n setAuthenticated(isAuth);\n };\n\n if (authenticated) {\n // history.push('/Home');\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/Home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 33,\n columnNumber: 16\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(LoginForm, {\n onFinish: onFinish\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 16\n }, this);\n }\n};\n\n_s(Login, \"z7Cl2nD1bbitBQQ63vycoqqSO10=\");\n\n_c = Login;\nexport default _c2 = withRouter(Login);\n\nvar _c, _c2;\n\n$RefreshReg$(_c, \"Login\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/src/Container/Login.js"],"names":["React","useState","LoginForm","getLoginInfo","Redirect","withRouter","fetchLogInfo","data","result","status","console","log","e","alert","Login","authenticated","setAuthenticated","onFinish","values","isAuth","sessionStorage","setItem","userid"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAcC,QAAd,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,wBAAtB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAAQC,QAAR,EAAkBC,UAAlB,QAAmC,kBAAnC;;AAEA,MAAMC,YAAY,GAAE,MAAMC,IAAN,IAAc;AAC9B,MAAG;AACC,UAAMC,MAAM,GAAG,MAAML,YAAY,CAACI,IAAD,CAAjC;;AACA,QAAGC,MAAM,CAACC,MAAP,KAAiB,GAApB,EAAwB;AACxBC,MAAAA,OAAO,CAACC,GAAR,CAAY,iBAAgBH,MAAM,CAACD,IAAnC,EADwB,CACmB;;AAC3C,aAAO,IAAP;AACC;AACJ,GAND,CAME,OAAMK,CAAN,EAAQ;AACNF,IAAAA,OAAO,CAACC,GAAR,CAAYC,CAAZ;AACAC,IAAAA,KAAK,CAAC,mBAAD,CAAL;AACA,WAAO,KAAP;AACH;AACJ,CAZD;;AAcA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAElB,QAAM,CAACC,aAAD,EAAeC,gBAAf,IAAmCf,QAAQ,CAAC,KAAD,CAAjD;;AACA,QAAMgB,QAAQ,GAAG,MAAOC,MAAP,IAAiB;AAC9BR,IAAAA,OAAO,CAACC,GAAR,CAAY,2BAAZ,EAAyCO,MAAzC;AACA,UAAMC,MAAM,GAAG,MAAMb,YAAY,CAACY,MAAD,CAAjC;AACAE,IAAAA,cAAc,CAACC,OAAf,CAAuB,QAAvB,EAAiCF,MAAjC,EAH8B,CAGY;;AAC1CC,IAAAA,cAAc,CAACC,OAAf,CAAuB,IAAvB,EAA4BH,MAAM,CAACI,MAAnC;AAEAN,IAAAA,gBAAgB,CAACG,MAAD,CAAhB;AACD,GAPH;;AAQI,MAAGJ,aAAH,EAAiB;AACf;AACA,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD,GAHD,MAGK;AACH,wBAAO,QAAC,SAAD;AAAW,MAAA,QAAQ,EAAEE;AAArB;AAAA;AAAA;AAAA;AAAA,YAAP;AAED;AACN,CAlBD;;GAAMH,K;;KAAAA,K;AAoBN,qBAAeT,UAAU,CAACS,KAAD,CAAzB","sourcesContent":["import React,{useState} from 'react';\r\nimport LoginForm from '../component/LoginForm';\r\nimport { getLoginInfo } from '../lib/api/login';\r\nimport {Redirect, withRouter} from \"react-router-dom\";\r\n\r\nconst fetchLogInfo= async(data) =>{\r\n try{\r\n const result = await getLoginInfo(data);\r\n if(result.status ===200){\r\n console.log(\"서버 데이터와 일치: \"+ result.data ); // result의 반환값 확인\r\n return true;\r\n }\r\n } catch(e){\r\n console.log(e);\r\n alert(\"id와 비밀번호를 확인해주세요!\");\r\n return false;\r\n }\r\n}\r\n\r\nconst Login = () => {\r\n\r\n const [authenticated,setAuthenticated] = useState(false);\r\n const onFinish = async (values)=> {\r\n console.log('Received values of form: ', values);\r\n const isAuth = await fetchLogInfo(values);\r\n sessionStorage.setItem(\"isAuth\", isAuth); //세션 스토리지 저장\r\n sessionStorage.setItem(\"id\",values.userid);\r\n\r\n setAuthenticated(isAuth);\r\n }\r\n if(authenticated){\r\n // history.push('/Home');\r\n return <Redirect to=\"/Home\"/>\r\n }else{\r\n return <LoginForm onFinish={onFinish} >\r\n </LoginForm>\r\n }\r\n};\r\n\r\nexport default withRouter(Login);\r\n"]},"metadata":{},"sourceType":"module"}