From feca890abf05fa101ab58892acc56eefd1ff2d03 Mon Sep 17 00:00:00 2001 From: youkyeong60 Date: Wed, 20 Dec 2023 15:26:37 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20storage=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal-secession/modal-secession.component.js | 2 +- src/helper/auth.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/modal-secession/modal-secession.component.js b/src/components/modal-secession/modal-secession.component.js index 0d33d4c..1e01a6b 100644 --- a/src/components/modal-secession/modal-secession.component.js +++ b/src/components/modal-secession/modal-secession.component.js @@ -25,7 +25,7 @@ export default class ModalSecession extends Component { } else { const result = await fetchSecession({ password }); if (result) { - sessionStorage.setItem('isLogin', false); + localStorage.setItem('isLogin', false); const { router } = store.getState(); router.navigate('/'); } diff --git a/src/helper/auth.js b/src/helper/auth.js index 021d2f1..cbf05a7 100644 --- a/src/helper/auth.js +++ b/src/helper/auth.js @@ -1,7 +1,7 @@ import { store } from '../store/store'; export function signIn() { - sessionStorage.setItem('isLogin', true); + localStorage.setItem('isLogin', true); } export function redirectSignInPage() { @@ -17,7 +17,7 @@ export function redirectMypage() { export async function signOut() { try { await fetch('/api/signout'); - sessionStorage.setItem('isLogin', false); + localStorage.setItem('isLogin', false); redirectSignInPage(); } catch (err) { console.log(err); @@ -25,23 +25,23 @@ export async function signOut() { } export function init() { - sessionStorage.setItem('isInit', true); + localStorage.setItem('isInit', true); } export function unInit() { - sessionStorage.setItem('isInit', false); + localStorage.setItem('isInit', false); } export function checkIsSignIn() { if (typeof window === 'undefined') return false; - const isLogin = sessionStorage.getItem('isLogin'); + const isLogin = localStorage.getItem('isLogin'); if (isLogin === null || isLogin === 'false') return false; return true; } export function checkIsInit() { if (typeof window === 'undefined') return false; - const isInit = sessionStorage.getItem('isInit'); + const isInit = localStorage.getItem('isInit'); if (isInit === null || isInit === 'false') return false; return true; }