From 5e23f8e9e7c36cf67135244486651239574c500c Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Thu, 18 Jan 2024 19:12:14 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B0=81=EC=9E=90=20=EB=B0=9B=EC=95=84?= =?UTF-8?q?=EC=98=A8=20=ED=86=A0=ED=81=B0=EC=9C=BC=EB=A1=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LecueNote/api/postLecueNote.ts | 4 +++- src/Mypage/api/deleteMyBook.ts | 3 ++- src/Mypage/api/getMyBookList.ts | 3 ++- src/Mypage/api/getMyNickName.ts | 3 ++- src/Mypage/api/getMyNoteList.ts | 3 ++- src/StickerAttach/api/postStickerState.ts | 3 ++- src/StickerPack/api/getBookUuid.ts | 3 ++- src/Target/page/TargetPage/index.tsx | 2 +- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/LecueNote/api/postLecueNote.ts b/src/LecueNote/api/postLecueNote.ts index c7917164..62d81730 100644 --- a/src/LecueNote/api/postLecueNote.ts +++ b/src/LecueNote/api/postLecueNote.ts @@ -9,6 +9,8 @@ const postLecueNote = ({ isIconClicked, bookId, }: postLecueNoteProps) => { + const token = localStorage.getItem('token'); + const response = api.post( '/api/notes', { @@ -19,7 +21,7 @@ const postLecueNote = ({ }, { headers: { - Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`, + Authorization: `Bearer ${token}`, }, }, ); diff --git a/src/Mypage/api/deleteMyBook.ts b/src/Mypage/api/deleteMyBook.ts index d58d45e8..df898e04 100644 --- a/src/Mypage/api/deleteMyBook.ts +++ b/src/Mypage/api/deleteMyBook.ts @@ -1,10 +1,11 @@ import { api } from '../../libs/api'; export async function deleteMyBook(bookId: number) { + const token = localStorage.getItem('token'); const data = await api.delete(`/api/books/${bookId}`, { headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`, + Authorization: `Bearer ${token}`, }, }); diff --git a/src/Mypage/api/getMyBookList.ts b/src/Mypage/api/getMyBookList.ts index 54bf32c6..09a063d3 100644 --- a/src/Mypage/api/getMyBookList.ts +++ b/src/Mypage/api/getMyBookList.ts @@ -1,10 +1,11 @@ import { api } from '../../libs/api'; export async function getMyBookList() { + const token = localStorage.getItem('token'); const data = await api.get(`/api/mypage/book`, { headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`, + Authorization: `Bearer ${token}`, }, }); return data.data.data.bookList; diff --git a/src/Mypage/api/getMyNickName.ts b/src/Mypage/api/getMyNickName.ts index 54f0d83a..d555ab39 100644 --- a/src/Mypage/api/getMyNickName.ts +++ b/src/Mypage/api/getMyNickName.ts @@ -1,10 +1,11 @@ import { api } from '../../libs/api'; export async function getMyNickName() { + const token = localStorage.getItem('token'); const data = await api.get(`/api/mypage/note`, { headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`, + Authorization: `Bearer ${token}`, }, }); return data.data.data.memberNickname; diff --git a/src/Mypage/api/getMyNoteList.ts b/src/Mypage/api/getMyNoteList.ts index f18e2f54..188b66a8 100644 --- a/src/Mypage/api/getMyNoteList.ts +++ b/src/Mypage/api/getMyNoteList.ts @@ -1,10 +1,11 @@ import { api } from '../../libs/api'; export async function getMyNoteList() { + const token = localStorage.getItem('token'); const data = await api.get(`/api/mypage/note`, { headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`, + Authorization: `Bearer ${token}`, }, }); return data.data.data.noteList; diff --git a/src/StickerAttach/api/postStickerState.ts b/src/StickerAttach/api/postStickerState.ts index 8423eac5..2ebbb919 100644 --- a/src/StickerAttach/api/postStickerState.ts +++ b/src/StickerAttach/api/postStickerState.ts @@ -7,6 +7,7 @@ export async function postStickerState({ positionX, positionY, }: postedStickerParams) { + const token = localStorage.getItem('token'); const data = await api.post( '/api/stickers', { @@ -18,7 +19,7 @@ export async function postStickerState({ { headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`, + Authorization: `Bearer ${token}`, }, }, ); diff --git a/src/StickerPack/api/getBookUuid.ts b/src/StickerPack/api/getBookUuid.ts index 5d16c07f..7b07aaa6 100644 --- a/src/StickerPack/api/getBookUuid.ts +++ b/src/StickerPack/api/getBookUuid.ts @@ -1,10 +1,11 @@ import { api } from '../../libs/api'; export async function getBookUuid(bookId: number) { + const token = localStorage.getItem('token'); const data = await api.get(`/api/stickers/${bookId}`, { headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`, + Authorization: `Bearer ${token}`, }, }); diff --git a/src/Target/page/TargetPage/index.tsx b/src/Target/page/TargetPage/index.tsx index 6ea52f01..fbbfedf4 100644 --- a/src/Target/page/TargetPage/index.tsx +++ b/src/Target/page/TargetPage/index.tsx @@ -52,7 +52,7 @@ function TargetPage() { }); }; - return isLoading || putMutation ? ( + return isLoading ? ( ) : (