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

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

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