diff --git a/src/apis/index.ts b/src/apis/index.ts
index 2e2e0c8..0c9405d 100644
--- a/src/apis/index.ts
+++ b/src/apis/index.ts
@@ -79,6 +79,8 @@ Axios.interceptors.response.use(
// refreshToken이 없다는 건 로그인을 해야 한다는 것
if (window.confirm('로그인이 필요한 서비스입니다.')) {
window.location.href = '/login';
+ } else {
+ window.history.go(-1);
}
}
} else if (error.response?.data?.code === 1001) {
@@ -91,7 +93,7 @@ Axios.interceptors.response.use(
)}`;
}
}
- return error;
+ throw error;
},
);
diff --git a/src/pages/DetailPosting/PostingBox.tsx b/src/pages/DetailPosting/PostingBox.tsx
index de5c7fc..ad16870 100644
--- a/src/pages/DetailPosting/PostingBox.tsx
+++ b/src/pages/DetailPosting/PostingBox.tsx
@@ -1,36 +1,15 @@
-import { useState, useEffect } from 'react';
-import { useParams } from 'react-router-dom';
import styled from 'styled-components';
import Attatchment from './Attatchment';
import Posting from './Posting';
import { PostingDataType } from '@/types';
import PostingNav from './PostingNav';
-import { useQuery } from 'react-query';
-import { fetchPostingDetail } from '@/apis/posting';
-import Loading from '@/components/Loading/Loading';
-
-const PostingBox: React.FC<{ postingType: string }> = ({ postingType }) => {
- const { id } = useParams();
- const postingId = parseInt(id as string, 10);
- const [isLike, setIsLike] = useState(false);
-
- const { isLoading, data } = useQuery(
- [postingType, 'detail', postingId],
- fetchPostingDetail(postingType, postingId),
- );
-
- useEffect(() => {
- const likeCheck = data?.data?.result?.likeCheck;
- if (likeCheck) {
- setIsLike(likeCheck);
- }
- }, [data?.data?.result?.likeCheck]);
-
- if (isLoading) return ;
-
- const postingData: PostingDataType = data?.data?.result;
-
+const PostingBox: React.FC<{
+ id: number;
+ postingData: PostingDataType;
+ isLike: boolean;
+ setIsLike: React.Dispatch>;
+}> = ({ id: postingId, postingData, isLike, setIsLike }) => {
return (
@@ -43,7 +22,7 @@ const PostingBox: React.FC<{ postingType: string }> = ({ postingType }) => {
);
diff --git a/src/pages/DetailPosting/index.tsx b/src/pages/DetailPosting/index.tsx
index bd7c7e9..2edf1c0 100644
--- a/src/pages/DetailPosting/index.tsx
+++ b/src/pages/DetailPosting/index.tsx
@@ -1,29 +1,67 @@
import styled from 'styled-components';
import PostingBox from './PostingBox';
import OtherPostings from './OtherPostings';
-import { useEffect } from 'react';
+import { useEffect, useState } from 'react';
+import { PostingDataType } from '@/types';
+import { useParams } from 'react-router-dom';
+import { useQuery } from 'react-query';
+import { fetchPostingDetail } from '@/apis/posting';
+import Loading from '@/components/Loading/Loading';
interface Props {
title: string;
}
const DetailPosting: React.FC = ({ title }) => {
+ const { id } = useParams();
+ const postingId = parseInt(id as string, 10);
+ const [isLike, setIsLike] = useState(false);
+
const postingType: string = window.location.pathname.includes('review')
? 'reviews'
: 'archives';
+ const { isLoading, data } = useQuery(
+ [postingType, 'detail', postingId],
+ fetchPostingDetail(postingType, postingId),
+ );
+
+ useEffect(() => {
+ const likeCheck = data?.data?.result?.likeCheck;
+ if (likeCheck) {
+ setIsLike(likeCheck);
+ }
+ }, [data?.data?.result?.likeCheck]);
+
+ useEffect(() => {
+ console.log('render');
+ }, []);
+
+ if (isLoading) return ;
+
useEffect(() => {
window.scrollTo({ top: 0, behavior: 'smooth' });
}, []);
+ const postingData: PostingDataType = data?.data?.result;
+
return (
-
- {title}
-
- {!window.location.pathname.includes('user') && (
-
+ <>
+ {postingData && (
+
+ {title}
+
+ {!window.location.pathname.includes('user') && (
+
+ )}
+
)}
-
+ >
);
};
diff --git a/src/pages/board/Board.tsx b/src/pages/board/Board.tsx
index 5405926..5ace541 100644
--- a/src/pages/board/Board.tsx
+++ b/src/pages/board/Board.tsx
@@ -106,8 +106,8 @@ const Container = styled.div`
align-items: center;
gap: 88px;
- padding: 0 260px;
- margin-bottom: 128px;
+ width: 1400px;
+ margin: 0 auto 128px;
`;
const SearchBarWrapper = styled.div`
diff --git a/src/pages/board/PostingList.tsx b/src/pages/board/PostingList.tsx
index c7ad515..a16d346 100644
--- a/src/pages/board/PostingList.tsx
+++ b/src/pages/board/PostingList.tsx
@@ -72,7 +72,7 @@ const TopBarContainer = styled.div`
background: var(--background, #f6f6f6);
.board_name {
- width: 63px;
+ width: 143px;
}
.title {
width: 580px;
@@ -83,7 +83,7 @@ const TopBarContainer = styled.div`
text-align: center;
}
.register_date {
- width: 91px;
+ width: 100px;
text-align: center;
}
`;
diff --git a/src/pages/board/components/Posting.tsx b/src/pages/board/components/Posting.tsx
index 80ce158..628d5dd 100644
--- a/src/pages/board/components/Posting.tsx
+++ b/src/pages/board/components/Posting.tsx
@@ -40,7 +40,9 @@ const Posting: React.FC = ({
{writer}
- {truncDate()}
+
+ {truncDate()}
+
);
};
@@ -57,7 +59,7 @@ const Container = styled.div`
border-bottom: 0.5px solid var(--grey-400, #e3e7ed);
.board_name {
- width: 64px;
+ width: 143px;
}
.title {
width: 580px;
@@ -76,4 +78,7 @@ const Container = styled.div`
width: 140px;
text-align: center;
}
+ .registerDate {
+ width: 100px;
+ }
`;
diff --git a/src/pages/map/components/MapCard.tsx b/src/pages/map/components/MapCard.tsx
index c190f40..c5a3569 100644
--- a/src/pages/map/components/MapCard.tsx
+++ b/src/pages/map/components/MapCard.tsx
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import styled from 'styled-components';
-import { B1Bold } from '../../../style/fonts/StyledFonts';
+import { B1Bold } from '@/style/fonts/StyledFonts';
import LikeButton from '@/components/Button/LikeButton';
import CloseIcon from '@/assets/icons/icon-close.svg';
@@ -52,7 +52,7 @@ const MapCard: React.FC = ({
- {remainDay}
+ {`D-${remainDay}`}
{programName}