From 3d832910a2c445fe991f46625d00fd6d65910120 Mon Sep 17 00:00:00 2001 From: carboxaminoo Date: Fri, 15 Mar 2024 17:33:18 +0900 Subject: [PATCH] Fix : Modify session error - #8 --- mz_v1_front/src/components/survey/survey.svelte | 12 +++--------- mz_v1_front/src/routes/home/+page.svelte | 8 +------- mz_v1_front/src/routes/result/+page.svelte | 8 +------- mz_v1_front/src/routes/resultlist/+page.svelte | 8 -------- 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/mz_v1_front/src/components/survey/survey.svelte b/mz_v1_front/src/components/survey/survey.svelte index 84b6aac..ebbcf2b 100644 --- a/mz_v1_front/src/components/survey/survey.svelte +++ b/mz_v1_front/src/components/survey/survey.svelte @@ -7,16 +7,10 @@ let token = null; - onMount(async () => { - try{ - token = sessionStorage.getItem('auth_token'); - } - catch(error){ - alert(`세션이 만료되었습니다.\n다시 로그인 해주세요.`); - goto('/'); - } - }); + token = sessionStorage.getItem('auth_token'); + + const SNS_time =[ {value: 0, label: '1시간 미만'}, diff --git a/mz_v1_front/src/routes/home/+page.svelte b/mz_v1_front/src/routes/home/+page.svelte index af04864..942cce7 100644 --- a/mz_v1_front/src/routes/home/+page.svelte +++ b/mz_v1_front/src/routes/home/+page.svelte @@ -6,13 +6,7 @@ import { goto } from '$app/navigation'; - onMount(() => { - try{token = sessionStorage.getItem('auth_token');} - catch(error){ - alert(`세션이 만료되었습니다.\n다시 로그인 해주세요.`); - goto('/'); - } - }); +
{ - try{ token = sessionStorage.getItem('auth_token'); gender =sessionStorage.getItem('gender'); id = sessionStorage.getItem('id'); latest_id = sessionStorage.getItem('latest_id'); - } - catch(error){ - alert(`세션이 만료되었습니다.\n다시 로그인 해주세요.`); - goto('/'); - } + const response = await fetch(`https://api.makezenerator.com/api/v1/mz-request/${id}/mz-result/${latest_id}`, { method: 'GET', headers: { diff --git a/mz_v1_front/src/routes/resultlist/+page.svelte b/mz_v1_front/src/routes/resultlist/+page.svelte index 567dac0..656b188 100644 --- a/mz_v1_front/src/routes/resultlist/+page.svelte +++ b/mz_v1_front/src/routes/resultlist/+page.svelte @@ -34,14 +34,6 @@ } onMount(() => { - try{ - token = sessionStorage.getItem('auth_token'); - } - catch(error){ - alert(`세션이 만료되었습니다.\n다시 로그인 해주세요.`); - goto('/'); - } - fetchData(); const interval = setInterval(fetchData, 5000);