Commit 787d8e4c authored by KangMin An's avatar KangMin An
Browse files

Merge remote-tracking branch 'gitlab/who' into premaster

parents a675d529 368e8dbe
......@@ -34,6 +34,7 @@
"react-use": "^17.2.4",
"sass": "^1.35.1",
"sequelize": "^6.6.5",
"sweetalert2": "^11.0.19",
"web-vitals": "^1.1.2"
}
},
......@@ -20778,6 +20779,14 @@
"boolbase": "~1.0.0"
}
},
"node_modules/sweetalert2": {
"version": "11.0.19",
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.0.19.tgz",
"integrity": "sha512-fJkiIhvOjDux8Ns08uWNdWPcLql5tpMpiuc78sYLjY9zTBvkj7rvmPHHckdkAZLKVGUmOfy8ckDZ1ElS0lLpjw==",
"funding": {
"url": "https://sweetalert2.github.io/#donations"
}
},
"node_modules/symbol-tree": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
......@@ -39678,6 +39687,11 @@
}
}
},
"sweetalert2": {
"version": "11.0.19",
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.0.19.tgz",
"integrity": "sha512-fJkiIhvOjDux8Ns08uWNdWPcLql5tpMpiuc78sYLjY9zTBvkj7rvmPHHckdkAZLKVGUmOfy8ckDZ1ElS0lLpjw=="
},
"symbol-tree": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
......@@ -30,6 +30,7 @@
"react-use": "^17.2.4",
"sass": "^1.35.1",
"sequelize": "^6.6.5",
"sweetalert2": "^11.0.19",
"web-vitals": "^1.1.2"
},
"scripts": {
......
import { Spinner, Button, Row } from 'react-bootstrap';
import { Spinner, Button, Row, Alert } from 'react-bootstrap';
import Swal from 'sweetalert2'
import '../App.css'
// export const KAKAO_AUTH_URL = `https://kauth.kakao.com/oauth/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&response_type=code`;
const { Kakao } = window;
export function LoginWithKakao() {
//authObj : response.data에 들어가 있는 부분 object 형식
Kakao.Auth.loginForm({
......@@ -12,7 +14,6 @@ export function LoginWithKakao() {
scope: 'account_email, profile_nickname',
// 추가 동의 받을 동의 항목 ID 목록, 하나의 문자열에 여러 개의 ID를 쉼표(,)로 구분하여 전달
success: function (authObj) {
alert('로그인 되었습니다. @@@@@@@@@')
console.log(JSON.stringify(authObj))
console.log('accT ;;', authObj.access_token)
......@@ -33,14 +34,29 @@ export function LoginWithKakao() {
localStorage.setItem('nickname', nickValue)
const nickname = localStorage.getItem('nickname')
console.log(nickname)
Swal.fire({
title: '로그인 성공!',
text: '🙌 환영합니다 🙌',
icon: 'success',
customClass: 'swal-wide',
confirmButtonText: '확인',
}).then((res) => {
if (res.isConfirmed) {
window.location.replace('/' + '?nickname=' + `${nickname}`)
}
else {
window.location.replace('/' + '?nickname=' + `${nickname}`)
}
})
}
});
},
fail: function (err) {
alert(JSON.stringify(err))
console.log(JSON.stringify(err))
},
})
}
)
}
export function kakaoLogout() {
......@@ -53,9 +69,21 @@ export function kakaoLogout() {
}
Kakao.Auth.logout(function () {
// 로그인 시 발급받은 토큰을 만료시키는 함수
alert('logout ok\naccess token -> ' + Kakao.Auth.getAccessToken())
localStorage.clear();
Swal.fire({
title: '로그아웃 성공!',
text: '🙏 안녕히 가세요 🙏',
icon: 'warning',
customClass: 'swal-wide',
confirmButtonText: '확인',
}).then((res) => {
if (res.isConfirmed) {
window.location.replace('/')
}
else {
window.location.replace('/')
}
})
})
}
......
import React from 'react'
import React, { useEffect, useState } from 'react'
import '../App.css'
import { Form, Button, Row, Col, Card, DropdownButton, Dropdown, ButtonGroup } from 'react-bootstrap';
import { useState } from 'react';
import axios from 'axios';
// import { doeCode } from '../utils/Auth';
function LocCodeChange() {
......@@ -28,7 +26,6 @@ function LocCodeChange() {
padding: '10px'
}
const btnstyled2 = {
background: 'white',
margin: '1px',
......@@ -47,34 +44,32 @@ function LocCodeChange() {
auth.style.visibility = 'visible'
}
// console.log(typeof (locCode()))
// console.log(locCode())
// const [ddoe, setDdoe] = useState([])
// async function DoeCode() {
// await doeCode().then((res) => {
// // // // for (let i = 0; i < res.length; i++) {
// // // console.log(res[0]['code_doe'])
// // // console.log(0, res[0]['name_doe'])
// ddoe.push(res[0]['name_doe'])
// ddoe.push(res[1]['name_doe'])
// console.log(ddoe)
// console.log(typeof(ddoe))
// // // }
// })
// }
const res = axios.get("localhost:4500/d/loccode");
// const does = res.data["locCodes"]["DOE"] // object
const [does, setDoes] = useState([])
const [sggs, setSggs] = useState([])
// const [emds, setEmds] = useState([])
const does_array = []
const sggs_array = []
// const emds_array = []
does.map((doesObj) => does_array.push(doesObj['name_doe']))
sggs.map((sggsObj) => console.log(sggsObj['sgg']))
console.log('does :: ', does)
console.log('does_array:::', does_array)
async function getLocCode() {
const res = await axios.get("http://localhost:4500/api/data/loccode")
const local_codes = res.data.locCodes
console.log('local_codes::: ', local_codes)
setDoes(local_codes.DOE)
setSggs(local_codes.SGG)
}
useEffect(() => {
getLocCode()
}, [])
return (
<Row className='text-center w-100 my-2'>
{/* {DoeCode()} */}
{/* {data} */}
asd
<Card style={cardstyled}>
<Card.Title id='impactTitle'>
Local Code
......@@ -84,22 +79,34 @@ function LocCodeChange() {
</Card.Subtitle>
<hr />
<Card.Text>
<Form style={inboxstyled}>
<Row className='m-auto w-100 d-flex justify-content-center'>
<Col md={12} xs={12} style={{ padding: '0', display: 'flex', justifyContent: 'center', width: '100%' }}>
{['', '시군구', '읍면동'].map((localname) => (
<DropdownButton
variant='light'
style={btnstyled2}
title='지역코드'
as={ButtonGroup}
title={` ${localname} `}>
<Dropdown.Item></Dropdown.Item>
<Dropdown.Item>Another action</Dropdown.Item>
<Dropdown.Item>Something else here</Dropdown.Item>
</DropdownButton>
<Form.Group style={btnstyled2}>
<Form.Control as='select' aria-label="Floating label select example">
<option></option>
{does.map((doe) => (
<option value={`${doe["code_doe"]}`}>
{`${doe["name_doe"]}`}</option>
))}
</Form.Control>
<Form.Control as='select' aria-label="Floating label select example">
<option>시군구</option>
{does.map((doe) => (
<option value={`${doe["code_doe"]}`}>
{`${doe["name_doe"]}`}</option>
))}
</Form.Control>
<Form.Control as='select' aria-label="Floating label select example">
<option>읍면동</option>
{does.map((doe) => (
<option value={`${doe["code_doe"]}`}>
{`${doe["name_doe"]}`}</option>
))}
</Form.Control>
</Form.Group>
<Button variant='light' style={btnstyled2} onClick={!locCodeShow && handleClickLoc}>확인</Button>
</Col>
<Col md={6} xs={4} id='loc-code' style={{
......@@ -109,8 +116,8 @@ function LocCodeChange() {
display: 'flex',
justifyContent: 'center',
padding: '2px',
visibility: 'hidden',
transition: 'all 4s'
// visibility: 'hidden',
transition: 'all 2s'
}}>
지역코드
</Col>
......
......@@ -31,6 +31,22 @@ function LoginComp() {
function CheckEmailSend() {
setEmailSent(!emailSent)
}
function addressUrl() {
localStorage.setItem('Email-Address', emailAddress)
const afterAt = localStorage.getItem('Email-Address').split('@')[1]
console.log(afterAt)
const newLink = 'https://www.' + afterAt;
window.open(newLink);
}
const [emailAddress, setEmailAddress] = useState('')
function handleChange(event) {
setEmailAddress(event.target.value)
console.log(emailAddress)
}
return (
......@@ -50,7 +66,7 @@ function LoginComp() {
<Col>
😍 이메일 전송이 완료 되었습니다.
</Col>
<Alert.Link href='/' style={{ fontSize: '0.8em' }}>
<Alert.Link href="" onClick={addressUrl} target='_blank' style={{ fontSize: '0.8em' }}>
이메일 확인 하러가기
</Alert.Link>
</Alert>
......@@ -59,6 +75,9 @@ function LoginComp() {
<Col>
😭 이메일을 정확하게 적어주세요.
</Col>
<Alert.Link href="/signup" target='_blank' style={{ fontSize: '0.8em' }}>
회원가입 하러가기
</Alert.Link>
</Alert>
}
<Button onClick={() => setAlertShow(true)}>보여주고</Button>
......@@ -66,10 +85,10 @@ function LoginComp() {
</Row>
<Form style={inboxstyled}>
<Form.Group controlId="formBasicEmail">
<Form.Control type="email" placeholder="Email" />
<Form.Control type="email" placeholder="Email" onChange={handleChange} />
</Form.Group>
<Button variant='light' id='formbtn' onClick={CheckEmailSend}>
<Button variant='light' type="submit" id='formbtn' onClick={CheckEmailSend}>
LOGIN
</Button>
......
......@@ -38,6 +38,7 @@ function MainLayer() {
return (
<>
<Row className='d-flex align-items-center m-auto w-100'>
<Link to='/' className=' m-auto'>
<Image src='/images/EUE11.jpg' alt='EUE' style={boxstyled} />
......
......@@ -138,7 +138,8 @@ function SignupComp() {
</Row>
</Form.Group>
<Button variant='light' className='mt-2' type="submit" id='formbtn' onClick={CheckUserExist}>
<Button variant='light' className='mt-2' id='formbtn' onClick={CheckUserExist}>
{/* type="submit" */}
Sign Up
</Button>
</Form>
......
// # Global Routes
const BASE = "/api";
// # Data Routes
const DATA = "/data";
// Data - Collector
const DATA_INPUT = "/input";
// Data - Consumer
const DATA_USER = "/user";
const DATA_OUTSIDE = "/outside";
// # Local Code Data
const LOCCODE = "/loccode";
// # Auth
const SIGNUP = "/signup";
const LOGIN = "/login";
const CONFIRM = "/confirm";
const EDIT_PROFILE = "/edit-profile";
// # Detail Object
const DETAIL = "/:id";
const routes = {
base: BASE,
data: DATA,
dataInput: DATA_INPUT,
dataUser: DATA_USER,
dataOutside: DATA_OUTSIDE,
locCode: LOCCODE,
signup: SIGNUP,
login: LOGIN,
confirm: CONFIRM,
editProfile: EDIT_PROFILE,
Detail: (id) => {
if (id) {
return `/${id}`;
} else {
return DETAIL;
}
},
};
export default routes;
......@@ -5,7 +5,7 @@
"main": "init.js",
"scripts": {
"dev:server": "nodemon --exec babel-node src/init.js --delay 2",
"dev:server_window": "nodemon --exec\"npx babel-node src/init.js\" --delay 2",
"dev:server_window": "nodemon --exec \"npx babel-node src/init.js\" --delay 2",
"start": "babel-node src/init.js"
},
"repository": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment