자동 로그인, 로그아웃 추적
This commit is contained in:
parent
138bdbdd35
commit
ccf60ee784
@ -3,6 +3,7 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { setSession, login } from '@/lib/authActions'
|
import { setSession, login } from '@/lib/authActions'
|
||||||
|
import Cookies from 'js-cookie'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import { useRecoilState } from 'recoil'
|
import { useRecoilState } from 'recoil'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
@ -31,6 +32,7 @@ export default function AutoLoginPage({ autoLoginParam }) {
|
|||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
const res = response.data
|
const res = response.data
|
||||||
|
if (res.sessionId) Cookies.set('sessionId', res.sessionId)
|
||||||
const result = { ...res, storeLvl: res.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' }
|
const result = { ...res, storeLvl: res.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' }
|
||||||
setSession(result)
|
setSession(result)
|
||||||
setSessionState(result)
|
setSessionState(result)
|
||||||
|
|||||||
@ -48,6 +48,7 @@ export default function Login() {
|
|||||||
post({ url: '/api/login/v1.0/user', data: { loginId: res.data } }).then((response) => {
|
post({ url: '/api/login/v1.0/user', data: { loginId: res.data } }).then((response) => {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
if (response) {
|
if (response) {
|
||||||
|
if (response.sessionId) Cookies.set('sessionId', response.sessionId)
|
||||||
const result = { ...response, storeLvl: response.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' }
|
const result = { ...response, storeLvl: response.groupId === '60000' ? '1' : '2', pwdInitYn: 'Y' }
|
||||||
setSession(result)
|
setSession(result)
|
||||||
setSessionState(result)
|
setSessionState(result)
|
||||||
@ -107,7 +108,7 @@ export default function Login() {
|
|||||||
if (res) {
|
if (res) {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
if (res.data.result.resultCode === 'S') {
|
if (res.data.result.resultCode === 'S') {
|
||||||
Cookies.set('sessionId', res.data.sessionId)
|
if (res.data.sessionId) Cookies.set('sessionId', res.data.sessionId)
|
||||||
setSession(res.data.data)
|
setSession(res.data.data)
|
||||||
setSessionState(res.data.data)
|
setSessionState(res.data.data)
|
||||||
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
// ID SAVE 체크되어 있는 경우, 쿠키 저장
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user