-
Notifications
You must be signed in to change notification settings - Fork 7
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 #331 from woowacourse-teams/dev/fe
[FE] 3차 데모데이 - 1차 QA 후 수정사항 반영
- Loading branch information
Showing
23 changed files
with
648 additions
and
95 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 |
---|---|---|
|
@@ -9,3 +9,8 @@ | |
|
||
### Environment Variable ### | ||
.env | ||
|
||
*.crt | ||
*.csr | ||
*.key | ||
*.pem |
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
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,27 +1,28 @@ | ||
import { useCallback, useEffect } from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { ToastContext } from '@/context/ToastContext'; | ||
import { useLoginStateQuery } from '@/queries/authentication/useLoginStateQuery'; | ||
import useCustomContext from '../utils/useCustomContext'; | ||
import { useAuth } from './useAuth'; | ||
|
||
export const useCheckLoginState = () => { | ||
const { error, isError, isSuccess } = useLoginStateQuery(); | ||
const { error, isError, status } = useLoginStateQuery(); | ||
const navigate = useNavigate(); | ||
const { handleLoginState } = useAuth(); | ||
const { infoAlert } = useCustomContext(ToastContext); | ||
|
||
const handleLoginNavigate = useCallback(() => { | ||
navigate('/login'); | ||
}, [navigate]); | ||
|
||
useEffect(() => { | ||
if (isError) { | ||
alert(error.message); | ||
handleLoginNavigate(); | ||
handleLoginState(false); | ||
} | ||
|
||
if (isSuccess) { | ||
if (status === 'success') { | ||
handleLoginState(true); | ||
} | ||
}, [error, isError, isSuccess, handleLoginNavigate, handleLoginState]); | ||
}, [error, isError, status, handleLoginNavigate, handleLoginState, infoAlert]); | ||
}; |
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 +1,2 @@ | ||
export { useWindowWidth } from './useWindowWidth'; | ||
export { useDebounce } from './utils/useDebounce'; |
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,17 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
export const useDebounce = (value: string, delay: number) => { | ||
const [debouncedValue, setDebouncedValue] = useState(value); | ||
|
||
useEffect(() => { | ||
const handler = setTimeout(() => { | ||
setDebouncedValue(value); | ||
}, delay); | ||
|
||
return () => { | ||
clearTimeout(handler); | ||
}; | ||
}, [value, delay]); | ||
|
||
return debouncedValue; | ||
}; |
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,5 +1,9 @@ | ||
{ | ||
"categories": [ | ||
{ | ||
"id": 1, | ||
"name": "카테고리 없음" | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Category1" | ||
|
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
Oops, something went wrong.