Commit 0f1b5291 authored by Spark's avatar Spark
Browse files

first-loc_code 입력시 로그인 여부 확인

parent 5dfc26a1
......@@ -9,6 +9,7 @@ import ChartDoughnut from '../components/ChartDoughnut';
import Donation from '../components/Donation';
import LocCodeChange from '../components/LocCodeChange';
import { callUserInfo } from '../utils/CheckDB';
import { isLogined } from './../utils/Auth';
function GetLocFirst() {
const constyled = {
......@@ -32,28 +33,26 @@ function GetLocFirst() {
padding: '0'
}
const [existLoc, setExistLoc] = useState('')
const [show, setShow] = useState(false)
useEffect(() => {
callUserInfo().then((res) => {
setExistLoc(res[0]['loc_code'])
if (isLogined()) {
const existLoc = res[0]['loc_code']
if (existLoc === null) {
setTimeout(function () {
setShow(true)
}, 1000)
}
else {
console.log('Already has Loc_code')
window.location.replace('/')
}
}
})
}, [])
useEffect(() => {
if (existLoc === '') {
setTimeout(function () {
setShow(true)
}, 1500)
}
else {
setShow(false)
window.location.replace('/')
}
}, [existLoc])
return (
<Container className='m-auto d-flex position-relative'
......
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