-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from so1s/SO1S-497
SO1S-497 토큰 만료등 401시 로그인 페이지로 리다이렉트
- Loading branch information
Showing
7 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useAtom } from 'jotai'; | ||
import { useEffect } from 'react'; | ||
import { useLocation } from 'react-router-dom'; | ||
import currentPage from '../atoms/current-page'; | ||
import { WithHeaderProps } from '../types/hocs'; | ||
|
||
export const WithHeader: React.FC<WithHeaderProps> = ({ children, datum }) => { | ||
const location = useLocation(); | ||
const [, setPage] = useAtom(currentPage); | ||
|
||
useEffect(() => { | ||
if (location.pathname === datum.uri) { | ||
setPage(datum); | ||
} | ||
}, [datum, location.pathname]); | ||
|
||
return <>{children}</>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
import IRouterDatum from '../../interfaces/router'; | ||
|
||
export type HoCProps = { | ||
children?: React.ReactNode; | ||
}; | ||
|
||
export type WithHeaderProps = HoCProps & { | ||
datum: IRouterDatum; | ||
}; |