Skip to content

Commit

Permalink
feat: 각자 받아온 토큰으로 사용하도록 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Arooming committed Jan 18, 2024
1 parent f86b013 commit 5e23f8e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/LecueNote/api/postLecueNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const postLecueNote = ({
isIconClicked,
bookId,
}: postLecueNoteProps) => {
const token = localStorage.getItem('token');

const response = api.post(
'/api/notes',
{
Expand All @@ -19,7 +21,7 @@ const postLecueNote = ({
},
{
headers: {
Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`,
Authorization: `Bearer ${token}`,
},
},
);
Expand Down
3 changes: 2 additions & 1 deletion src/Mypage/api/deleteMyBook.ts
Original file line number Diff line number Diff line change
@@ -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}`,
},
});

Expand Down
3 changes: 2 additions & 1 deletion src/Mypage/api/getMyBookList.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/Mypage/api/getMyNickName.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/Mypage/api/getMyNoteList.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/StickerAttach/api/postStickerState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export async function postStickerState({
positionX,
positionY,
}: postedStickerParams) {
const token = localStorage.getItem('token');
const data = await api.post(
'/api/stickers',
{
Expand All @@ -18,7 +19,7 @@ export async function postStickerState({
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${import.meta.env.VITE_APP_TOKEN}`,
Authorization: `Bearer ${token}`,
},
},
);
Expand Down
3 changes: 2 additions & 1 deletion src/StickerPack/api/getBookUuid.ts
Original file line number Diff line number Diff line change
@@ -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}`,
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/Target/page/TargetPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function TargetPage() {
});
};

return isLoading || putMutation ? (
return isLoading ? (
<LoadingPage />
) : (
<S.TargetPageWrapper>
Expand Down

0 comments on commit 5e23f8e

Please sign in to comment.