Skip to content

Commit

Permalink
알림 배지에 Suspense, ErrorBoundary 래핑 (#369)
Browse files Browse the repository at this point in the history
* feat: axiosInstance 타임아웃 추가

* feat: 헤더 알림 배지에 Suspense, ErrorBoundary 래핑
  • Loading branch information
dlwl98 authored Nov 27, 2023
1 parent cf66b67 commit 2cc3289
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/api/axiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const axiosInstance = axios.create({
headers: {
'Content-type': 'application/json',
},
timeout: 5000,
withCredentials: true,
});

Expand Down
8 changes: 7 additions & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Suspense } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { useNavigate } from 'react-router-dom';

import { Avatar } from '@components/Avatar';
Expand Down Expand Up @@ -100,7 +102,11 @@ export const Header = ({
<RightSideIconWrapper>
<BellIcon onClick={() => handleBellIconClick()}>
<img src={bellIcon} alt="" />
<Badge />
<ErrorBoundary fallback={<></>}>
<Suspense fallback={null}>
<Badge />
</Suspense>
</ErrorBoundary>
</BellIcon>
</RightSideIconWrapper>
<RightSideIconWrapper>
Expand Down

0 comments on commit 2cc3289

Please sign in to comment.