From 89a429251c7ca8bc311cee69a5c432c7b7e942fb Mon Sep 17 00:00:00 2001 From: Soyeon Park <86656217+soyeonysoss@users.noreply.github.com> Date: Sun, 5 Jun 2022 11:11:52 +0900 Subject: [PATCH 1/3] =?UTF-8?q?bookmarkListList=20=EA=B0=80=EC=A0=B8?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20=EB=B6=80=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/bookmark/index.jsx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pages/bookmark/index.jsx b/pages/bookmark/index.jsx index 36dffdc..971f0ec 100644 --- a/pages/bookmark/index.jsx +++ b/pages/bookmark/index.jsx @@ -1,26 +1,24 @@ import { useState, useEffect } from 'react'; import Head from 'next/head'; import PropTypes from 'prop-types'; -import { mockBookmarkListList } from '../../mock'; import { BookmarkList } from '../../components/bookmark/BookmarkList'; +import { useQuery } from 'react-query'; -export async function getServerSideProps() { - return { - props: { - bookmarkListList: mockBookmarkListList, - }, - }; -} - -function BookmarkDetail({ bookmarkId, bookmarkListList }) { +function BookmarkDetail({ bookmarkId }) { + const { + data: bookmarkListList, + isLoading: isBookmarkListListLoading, + isError: isBookmarkListListError, + } = useQuery('bookmarkList'); + const [auth, setAuth] = useState({ username: '', isAuth: false, }); useEffect(() => { - const jwt = window.sessionStorage.getItem('jwt'); - const username = window.sessionStorage.getItem('username'); + const jwt = window.localStorage.getItem('jwt'); + const username = window.localStorage.getItem('username'); setAuth({ username, @@ -37,10 +35,12 @@ function BookmarkDetail({ bookmarkId, bookmarkListList }) {
{auth.isAuth ? ( <> - + {!isBookmarkListListLoading && !isBookmarkListListError && ( + + )}
상단의 북마크를 선택해주세요
From 1c069b89fa802477f0a23544965573997c4ea5c8 Mon Sep 17 00:00:00 2001 From: Soyeon Park <86656217+soyeonysoss@users.noreply.github.com> Date: Sun, 5 Jun 2022 11:12:25 +0900 Subject: [PATCH 2/3] =?UTF-8?q?mock=20data=20code=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/bookmark/[bookmarkId]/index.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/pages/bookmark/[bookmarkId]/index.jsx b/pages/bookmark/[bookmarkId]/index.jsx index 24a82b3..52d6976 100644 --- a/pages/bookmark/[bookmarkId]/index.jsx +++ b/pages/bookmark/[bookmarkId]/index.jsx @@ -1,7 +1,6 @@ import Head from 'next/head'; import { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; -import { mockBookmarkList, mockBookmarkListList } from '../../../mock'; import BookmarkMain from '../../../components/bookmark/BookmarkMain'; export async function getServerSideProps(context) { @@ -9,8 +8,6 @@ export async function getServerSideProps(context) { return { props: { bookmarkId, - bookmarkList: mockBookmarkList[bookmarkId], - bookmarkListList: mockBookmarkListList, }, }; } From d76787f62cb529b8128c22cb56e4a1210673739a Mon Sep 17 00:00:00 2001 From: Soyeon Park <86656217+soyeonysoss@users.noreply.github.com> Date: Sun, 5 Jun 2022 11:15:13 +0900 Subject: [PATCH 3/3] =?UTF-8?q?bookmarkListList,=20bookmarkList=20response?= =?UTF-8?q?=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/bookmark/BookmarkMain.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/bookmark/BookmarkMain.jsx b/components/bookmark/BookmarkMain.jsx index 6d397d6..2ba2d02 100644 --- a/components/bookmark/BookmarkMain.jsx +++ b/components/bookmark/BookmarkMain.jsx @@ -30,16 +30,17 @@ function BookmarkMain({ bookmarkId }) { return getBookmark(token, bookmarkId); }, }); + console.log(bookmarkList); // getBookmark의 response 아닌 getBookmarkList의 response 나오는 문제 return (
{!isBookmarkListListLoading && !isBookmarkListListError && ( )} - {!isBookmarkListLoading && !isBookmarkListError && ( + {/* {!isBookmarkListLoading && !isBookmarkListError && ( <> - )} -
+ )} */} +
); }