Commit c75fa51
authored
Cache onboarding + Logout 추가 (#45)
* fix: improve onboarding redirect logic and implement logout
- Add logout functionality in MyPage component using auth store
- Optimize onboarding page redirect by using useGoals hook with loading state
- Replace window.location.href with Next.js router.replace() for better performance
- Add loading spinner during goal data fetch in onboarding
- Remove SSR/CSR conflicts by moving redirect logic to useEffect
* fix: handle Zustand hydration delay in onboarding page
- Add hydration state check to prevent premature login state evaluation
- Wait 50ms for Zustand persist data to hydrate before checking login status
- Show loading spinner during hydration process
- Add debug console logs for hydration and auth states
- Fix redirect logic to only execute after store has been properly hydrated
* fix: resolve 401 error and smooth onboarding page transitions
- Fix premature API call issue where useGoals was called before login completion
- Add error handling and retry logic for 401 authentication errors
- Use SWR mutate function to retry goals API after successful login
- Improve loading state logic to prevent flickering during page transitions
- Set shouldRetryOnError to false to prevent automatic retries on auth errors
- Show loading spinner until proper authentication and data fetching is complete
* fix: improve loading spinner visibility and eliminate page flash
- Change spinner color from border-primary-500 to border-gray-800 for better visibility on white background
- Add additional loading state for when goals exist and redirect is about to happen
- Prevent brief flash of onboarding content during page transitions
- Show consistent loading spinner during all redirect scenarios1 parent 550a888 commit c75fa51
2 files changed
+81
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
| 13 | + | |
11 | 14 | | |
12 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
13 | 66 | | |
14 | 67 | | |
15 | 68 | | |
| |||
33 | 86 | | |
34 | 87 | | |
35 | 88 | | |
36 | | - | |
| 89 | + | |
37 | 90 | | |
38 | 91 | | |
39 | 92 | | |
| |||
42 | 95 | | |
43 | 96 | | |
44 | 97 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
48 | 114 | | |
49 | 115 | | |
50 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| |||
0 commit comments