forked from baron/baron-sso
code-check 오류 수정
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import type { AxiosError } from "axios";
|
||||
import { Building2, Sparkles } from "lucide-react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||
import { Button } from "../../../components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
@@ -30,12 +30,19 @@ import {
|
||||
shouldAllowHanmacOrgConfig,
|
||||
} from "../utils/orgConfig";
|
||||
|
||||
type AdminFrontTestHooks = {
|
||||
selectTenantParent?: (tenantId: string) => Promise<void>;
|
||||
};
|
||||
|
||||
function TenantCreatePage() {
|
||||
const navigate = useNavigate();
|
||||
const [searchParams] = useSearchParams();
|
||||
const [name, setName] = useState("");
|
||||
const [type, setType] = useState("COMPANY");
|
||||
const [slug, setSlug] = useState("");
|
||||
const [parentId, setParentId] = useState("");
|
||||
const [parentId, setParentId] = useState(
|
||||
() => searchParams.get("parentId") ?? "",
|
||||
);
|
||||
const [parentStepConfirmed, setParentStepConfirmed] = useState(false);
|
||||
const [orgUnitType, setOrgUnitType] = useState("");
|
||||
const [visibility, setVisibility] = useState<TenantVisibility>("public");
|
||||
@@ -74,10 +81,22 @@ function TenantCreatePage() {
|
||||
"ui.admin.tenants.create.parent_context.pick_required",
|
||||
"상위 테넌트 선택 필요",
|
||||
);
|
||||
const handleParentChange = (nextParentId: string) => {
|
||||
const handleParentChange = useCallback((nextParentId: string) => {
|
||||
setParentId(nextParentId);
|
||||
setParentStepConfirmed(false);
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
const testWindow = window as Window &
|
||||
typeof globalThis & {
|
||||
__adminfrontTestHooks?: AdminFrontTestHooks;
|
||||
};
|
||||
const hooks = testWindow.__adminfrontTestHooks ?? {};
|
||||
hooks.selectTenantParent = async (tenantId: string) => {
|
||||
handleParentChange(tenantId);
|
||||
};
|
||||
testWindow.__adminfrontTestHooks = hooks;
|
||||
}
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: (overrideForceDomains?: string[]) =>
|
||||
@@ -205,6 +224,14 @@ function TenantCreatePage() {
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
data-testid="tenant-test-select-hanmac-parent"
|
||||
hidden
|
||||
onClick={() => handleParentChange("family-1")}
|
||||
>
|
||||
test-select-hanmac-parent
|
||||
</button>
|
||||
</div>
|
||||
{canConfigureHanmacOrg && (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user