[feat] negodata/front: 온보딩 페이지 추가 + 이용안내 모달 재작성
This commit is contained in:
1 parent
b368a19f79
commit
0d62440ee1
12 files changed
+1371
-278
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import {createBrowserRouter, redirect} from 'react-router';
|
||||
import {initAuth} from '../features/auth/service';
|
||||
import {isLoggedIn, hasRole} from '../stores/auth';
|
||||
import {hasSeenOnboarding} from '../features/onboarding/storage';
|
||||
import AuthenticatedLayout from '@/components/layout/AuthenticatedLayout';
|
||||
import LoginPage from '../pages/login';
|
||||
import DashboardPage from '../pages/dashboard';
|
||||
@@ -13,6 +14,7 @@ import QuotationPage from '../pages/quotation';
|
||||
import CardsPage from '../pages/cards';
|
||||
import MembersPage from '../pages/members';
|
||||
import NotificationsPage from '../pages/notifications';
|
||||
import OnboardingPage from '../pages/onboarding';
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
// dev 전용: import.meta.env.DEV가 false인 프로덕션 빌드에선 이 배열 항목과
|
||||
@@ -45,6 +47,7 @@ export const router = createBrowserRouter([
|
||||
Component: ForbiddenPage,
|
||||
},
|
||||
{
|
||||
path: 'onboarding',
|
||||
loader: async ({request}) => {
|
||||
await initAuth();
|
||||
if (!isLoggedIn()) {
|
||||
@@ -54,6 +57,22 @@ export const router = createBrowserRouter([
|
||||
}
|
||||
return null;
|
||||
},
|
||||
Component: OnboardingPage,
|
||||
},
|
||||
{
|
||||
loader: async ({request}) => {
|
||||
await initAuth();
|
||||
if (!isLoggedIn()) {
|
||||
const url = new URL(request.url);
|
||||
const from = encodeURIComponent(url.pathname + url.search);
|
||||
return redirect(`/login?redirect=${from}`);
|
||||
}
|
||||
// 최초 로그인 유저는 온보딩으로. 완료·건너뛰기 시 flag 저장되어 이후엔 통과.
|
||||
if (!hasSeenOnboarding()) {
|
||||
return redirect('/onboarding');
|
||||
}
|
||||
return null;
|
||||
},
|
||||
Component: AuthenticatedLayout,
|
||||
children: [
|
||||
{path: 'dashboard', Component: DashboardPage},
|
||||
|
||||
Reference in new issue
Block a user