관리자 기본 진입 경로 수정
This commit is contained in:
parent
778e8526d4
commit
bd046c4501
6 changed files with 62 additions and 25 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue