Skip to content

Commit

Permalink
Merge pull request #193 from Team-Lecue/hotfix/#187-SyncSticker
Browse files Browse the repository at this point in the history
[ HotFix ] Develop으로 가라!
  • Loading branch information
eunbeann authored Jan 18, 2024
2 parents 40128a8 + 9e9040c commit a0d39fa
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/Detail/components/ZigZagView/ZigZagView.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const ZigZagViewWrapper = styled.div`
position: relative;
width: 34.2rem;
padding: 0.4rem 0 2rem;
padding: 1rem 0 2rem;
`;

export const LecueNoteContainer = styled.div`
Expand All @@ -28,6 +28,10 @@ export const Sticker = styled.div<{
border-radius: 0.4rem;
background-position: center;
background-image: ${({ stickerImage }) => `url(${stickerImage})`};
background-size: 10rem 10rem;
background-repeat: no-repeat;
object-fit: cover;
object-fit: contain;
`;
1 change: 1 addition & 0 deletions src/Detail/hooks/useGetBookDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function useGetBookDetail(bookUuid: string) {
onError: () => {
navigate('/error');
},
refetchOnMount: 'always',
refetchOnWindowFocus: false,
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/LecueNote/page/LeceuNotePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function LecueNotePage() {
isIconClicked: isIconClicked,
bookId: bookId,
});
setTimeout(() => navigate(`/lecue-book/${bookUuid}`), 1000);
navigate(`/lecue-book/${bookUuid}`);
};

return putMutation.isLoading || postMutation.isLoading ? (
Expand Down
18 changes: 16 additions & 2 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Suspense } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
Expand Down Expand Up @@ -43,6 +44,7 @@ function Router() {
<Route path="/loading" element={<LoginCallback />} />
<Route path="/error" element={<ErrorPage />} />
<Route path="/loading-page" element={<LoadingPage />} />
<Route path="/*" element={<ErrorPage />} />
</Routes>
</Suspense>
</ErrorBoundary>
Expand All @@ -52,6 +54,18 @@ function Router() {

export default Router;

function fallbackRender() {
return <ErrorPage />;
function fallbackRender({ error, resetErrorBoundary }: any) {
const errorData = error?.error.response?.data;
if (errorData.code === 404) {
resetErrorBoundary();
return <Login />;
} else if (errorData.code === 401) {
resetErrorBoundary();
localStorage.removeItem('token');
localStorage.removeItem('nickname');
return <Login />;
return;
} else {
return <ErrorPage resetErrorBoundary={resetErrorBoundary} />;
}
}
4 changes: 3 additions & 1 deletion src/components/common/ErrorPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useNavigate } from 'react-router-dom';

import { ImgError } from '../../../assets';
import * as S from './ErrorPage.style';

function ErrorPage() {
function ErrorPage({ resetErrorBoundary }: any) {
const navigate = useNavigate();

const handleClickHomeButton = () => {
resetErrorBoundary();
navigate('/', { state: { step: 1 } });
};

Expand Down

0 comments on commit a0d39fa

Please sign in to comment.