-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 새로고침 대응안하고자 메모리 라우터로 변경 * local storage 키도 한곳에 모으기 * 유저 플로우 홈에다 적용 * 온보딩에서 선택페이지로 이동하도록 변경 * 마이페이지 고양이 이름 적용
- Loading branch information
Showing
7 changed files
with
42 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,24 @@ | ||
import { useEffect } from 'react'; | ||
|
||
import { useNavigate } from 'react-router-dom'; | ||
import { useLocalStorage } from 'usehooks-ts'; | ||
|
||
import { useUser } from '@/features/user'; | ||
import { PATH } from '@/shared/constants'; | ||
import { useAuthToken, useMachineId } from '@/shared/hooks'; | ||
import { Button } from '@/shared/ui'; | ||
import { LOCAL_STORAGE_KEY, PATH } from '@/shared/constants'; | ||
|
||
const Home = () => { | ||
const navigate = useNavigate(); | ||
const machineId = useMachineId(); | ||
const { data: authToken } = useAuthToken(); | ||
const [isCompleted] = useLocalStorage(LOCAL_STORAGE_KEY.ONBOARDING_COMPLETED, false); | ||
const { data: user } = useUser(); | ||
console.log('from env:', import.meta.env.VITE_SAMPLE); | ||
console.log('authToken:', authToken, 'user:', user); | ||
return ( | ||
<div> | ||
<p>your machine id: {machineId}</p> | ||
<Button | ||
onClick={() => { | ||
navigate(PATH.ONBOARDING); | ||
}} | ||
> | ||
온보딩 페이지로 가기 | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
navigate(PATH.SELECTION); | ||
}} | ||
> | ||
선택 페이지로 가기 | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
navigate(PATH.POMODORO); | ||
}} | ||
> | ||
뽀모도로 페이지로 가기 | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
navigate(PATH.NAMING); | ||
}} | ||
> | ||
이름짓기 페이지로 가기 | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
navigate(PATH.MY_PAGE); | ||
}} | ||
> | ||
마이 페이지로 가기 | ||
</Button> | ||
</div> | ||
); | ||
|
||
useEffect(() => { | ||
if (!user) return; | ||
if (!isCompleted) return navigate(PATH.ONBOARDING); | ||
if (!user.cat) return navigate(PATH.SELECTION); | ||
navigate(PATH.POMODORO); | ||
}, [isCompleted, user]); | ||
|
||
return <div>loading... 🐈 🐈⬛</div>; | ||
}; | ||
|
||
export default Home; |
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