관리자 기본 진입 경로 수정

This commit is contained in:
Yun Chan 2026-07-02 10:52:12 +09:00
parent 778e8526d4
commit bd046c4501
6 changed files with 62 additions and 25 deletions

View file

@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { roleHomePath, useAuth, type Role } from "../lib/auth";
import { initialPathForUser, useAuth, type Role } from "../lib/auth";
import { apiUrl, authApi, type AuthConfigResponse } from "../lib/api";
import { LoginBrand } from "./login/LoginBrand";
import { LoginPanel, type LoginRoleOption } from "./login/LoginPanel";
@ -172,14 +172,7 @@ export default function Login() {
setLoginErrorReason(null);
try {
const signedIn = await login(role);
navigate(
signedIn.accountStatus !== "approved"
? "/pending"
: signedIn.onboardingCompletedAt == null
? "/onboarding"
: roleHomePath(signedIn.role),
{ replace: true },
);
navigate(initialPathForUser(signedIn), { replace: true });
} catch (err) {
setLoginError(err instanceof Error ? err.message : "로그인에 실패했습니다.");
} finally {