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,27 +33,25 @@ function GetLocFirst() {
padding: '0'
}
const [existLoc, setExistLoc] = useState('')
const [show, setShow] = useState(false)
useEffect(() => {
callUserInfo().then((res) => {
setExistLoc(res[0]['loc_code'])
})
}, [])
useEffect(() => {
if (existLoc === '') {
if (isLogined()) {
const existLoc = res[0]['loc_code']
if (existLoc === null) {
setTimeout(function () {
setShow(true)
}, 1500)
}, 1000)
}
else {
setShow(false)
console.log('Already has Loc_code')
window.location.replace('/')
}
}, [existLoc])
}
})
}, [])
return (
......
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