-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
토큰 검사를 주기적으로 해야되는 페이지를 감싸는 레이아웃을 만들었습니다. 토큰 검사는 일단 30분에 한 번 동작하도록 만들었습니다.
- Loading branch information
1 parent
5a63b40
commit c67c4ec
Showing
2 changed files
with
27 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { validateExpiredToken } from 'commons/cookie/getUser'; | ||
import React, { useEffect } from 'react'; | ||
import { Routes } from 'react-router-dom'; | ||
|
||
interface LayoutProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const ValidateCheckLayout: React.FC<LayoutProps> = ({ children }) => { | ||
useEffect(() => { | ||
validateExpiredToken(); | ||
const intervalId = setInterval(validateExpiredToken, 60000 * 30); // 30분에 한 번 | ||
|
||
return () => clearInterval(intervalId); | ||
}, []); | ||
|
||
return <Routes>{children}</Routes>; | ||
}; | ||
|
||
export default ValidateCheckLayout; |