forked from baron/baron-sso
감사로그 화면 연동과 상태변경 로그 분리 및 CSV/UI 개선
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
ArrowLeft,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
Download,
|
||||
Filter,
|
||||
Search,
|
||||
} from "lucide-react";
|
||||
@@ -275,6 +276,7 @@ function ClientConsentsPage() {
|
||||
onClick={handleExportCSV}
|
||||
disabled={filteredRows.length === 0}
|
||||
>
|
||||
<Download className="h-4 w-4" />
|
||||
{t("ui.dev.clients.consents.export_csv", "Export CSV")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
deleteClient,
|
||||
fetchClient,
|
||||
updateClient,
|
||||
updateClientStatus,
|
||||
} from "../../lib/devApi";
|
||||
import type {
|
||||
ClientStatus,
|
||||
@@ -63,6 +64,7 @@ function ClientGeneralPage() {
|
||||
const [logoUrl, setLogoUrl] = useState("");
|
||||
const [clientType, setClientType] = useState<ClientType>("private");
|
||||
const [status, setStatus] = useState<ClientStatus>("active");
|
||||
const [initialStatus, setInitialStatus] = useState<ClientStatus>("active");
|
||||
const [redirectUris, setRedirectUris] = useState("");
|
||||
const [scopes, setScopes] = useState<ScopeItem[]>(() => [
|
||||
{
|
||||
@@ -91,6 +93,7 @@ function ClientGeneralPage() {
|
||||
setName(client.name || client.id);
|
||||
setClientType(client.type);
|
||||
setStatus(client.status);
|
||||
setInitialStatus(client.status);
|
||||
|
||||
const metadata = client.metadata ?? {};
|
||||
if (typeof metadata.description === "string")
|
||||
@@ -158,7 +161,6 @@ function ClientGeneralPage() {
|
||||
const payload: ClientUpsertRequest = {
|
||||
name,
|
||||
type: clientType,
|
||||
status,
|
||||
scopes: scopeNames,
|
||||
metadata: {
|
||||
description,
|
||||
@@ -169,6 +171,7 @@ function ClientGeneralPage() {
|
||||
|
||||
// 생성 시에는 Redirect URIs를 포함해서 전송
|
||||
if (isCreate) {
|
||||
payload.status = status;
|
||||
payload.redirectUris = redirectUris
|
||||
.split(",")
|
||||
.map((uri) => uri.trim())
|
||||
@@ -176,11 +179,19 @@ function ClientGeneralPage() {
|
||||
return createClient(payload);
|
||||
}
|
||||
|
||||
// 수정 시에는 Redirect URIs는 별도 탭에서 관리하므로 제외 (빈 배열이나 undefined로 보내지 않음)
|
||||
return updateClient(clientId as string, payload);
|
||||
// 수정 시에는 Redirect URIs는 별도 탭에서 관리하고,
|
||||
// status는 전용 PATCH API로 처리해서 감사로그 액션을 분리한다.
|
||||
const updated = await updateClient(clientId as string, payload);
|
||||
if (status !== initialStatus) {
|
||||
await updateClientStatus(clientId as string, status);
|
||||
}
|
||||
return updated;
|
||||
},
|
||||
onSuccess: (result) => {
|
||||
queryClient.invalidateQueries({ queryKey: ["clients"] });
|
||||
if (status !== initialStatus) {
|
||||
setInitialStatus(status);
|
||||
}
|
||||
if (result?.client?.id) {
|
||||
navigate(`/clients/${result.client.id}/settings`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user