theme.keycloak.v2.admin.resources.assets.CreateUser-CDqoYNq4.js Maven / Gradle / Ivy
import{jsx as a,jsxs as C,Fragment as w}from"react/jsx-runtime";import{u as y,a as A,f as F,d as b,c as x,g as E,v as P,a3 as V,P as j,j as k,bx as G,ek as N,el as R}from"./index-C1LIsRX7.js";import{useState as c}from"react";import{V as S}from"./ViewHeader-qjLr6U82.js";import{U as K,t as M}from"./UserForm-_c-oiMDM.js";/* empty css */import"react-dom";import"./SwitchControl-C3zDl-9W.js";import"./FormAccess-BcY70QlP.js";import"./copy-icon-DOS8MmN7.js";import"./GroupPickerDialog-DmX3SBxL.js";import"./PaginatingTableToolbar-CpMLQtqt.js";import"./EmptyStateFooter-Cm2IMTi1.js";import"./EmptyStateActions-DBSnfkAA.js";import"./DataListItemRow-COCiEHyF.js";import"./useFormatDate-Ypu7MAgr.js";function $(){const{adminClient:n}=y(),{t:r}=A(),{addAlert:d,addError:u}=F(),p=b(),{realm:m,realmRepresentation:s}=x(),o=E({mode:"onChange"}),[f,g]=c([]),[l,h]=c();P(()=>n.users.getProfileMetadata({realm:m}),t=>{if(!t)throw new Error(r("notFound"));o.setValue("attributes.locale",s?.defaultLocale||""),h(t)},[]);const U=async t=>{try{const e=await n.users.create({...M(t),groups:f.map(i=>i.path),enabled:!0});d(r("userCreated"),k.success),p(G({id:e.id,realm:m,tab:"settings"}))}catch(e){N(e)?R(e,o.setError,(i,v)=>r(i,v)):u("userCreateError",e)}};return!s||!l?a(V,{}):C(w,{children:[a(S,{titleKey:r("createUser"),className:"kc-username-view-header"}),a(j,{variant:"light",children:a(K,{form:o,realm:s,userProfileMetadata:l,onGroupsUpdate:g,save:U})})]})}export{$ as default};
//# sourceMappingURL=CreateUser-CDqoYNq4.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy