Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
theme.keycloak.v2.admin.resources.assets.CreateUser-c7931939.js.map Maven / Gradle / Ivy
Go to download
The user inferface to administrate the Keycloak server.
{"version":3,"file":"CreateUser-c7931939.js","sources":["../../src/user/CreateUser.tsx"],"sourcesContent":["import type GroupRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/groupRepresentation\";\nimport type UserRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/userRepresentation\";\nimport { AlertVariant, PageSection } from \"@patternfly/react-core\";\nimport { useState } from \"react\";\nimport { FormProvider, useForm } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { useNavigate } from \"react-router-dom\";\n\nimport { adminClient } from \"../admin-client\";\nimport { useAlerts } from \"../components/alert/Alerts\";\nimport { ViewHeader } from \"../components/view-header/ViewHeader\";\nimport { useRealm } from \"../context/realm-context/RealmContext\";\nimport { UserProfileProvider } from \"../realm-settings/user-profile/UserProfileContext\";\nimport { UserForm } from \"./UserForm\";\nimport {\n isUserProfileError,\n userProfileErrorToString,\n} from \"./UserProfileFields\";\nimport { toUser } from \"./routes/User\";\n\nimport \"./user-section.css\";\n\nexport default function CreateUser() {\n const { t } = useTranslation(\"users\");\n const { addAlert, addError } = useAlerts();\n const navigate = useNavigate();\n const { realm } = useRealm();\n const userForm = useForm({ mode: \"onChange\" });\n const [addedGroups, setAddedGroups] = useState([]);\n\n const save = async (formUser: UserRepresentation) => {\n try {\n const createdUser = await adminClient.users.create({\n ...formUser,\n username: formUser.username?.trim(),\n groups: addedGroups.map((group) => group.path!),\n enabled: true,\n });\n\n addAlert(t(\"userCreated\"), AlertVariant.success);\n navigate(toUser({ id: createdUser.id, realm, tab: \"settings\" }));\n } catch (error) {\n if (isUserProfileError(error)) {\n addError(userProfileErrorToString(error), error);\n } else {\n addError(\"users:userCreateError\", error);\n }\n }\n };\n\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n >\n );\n}\n"],"names":["CreateUser","useTranslation","addAlert","addError","useAlerts","navigate","useNavigate","realm","useRealm","userForm","useForm","addedGroups","setAddedGroups","useState","save","formUser","createdUser","adminClient","group","AlertVariant","toUser","error","isUserProfileError","userProfileErrorToString","jsxs","Fragment","jsx","ViewHeader","PageSection","UserProfileProvider","FormProvider","UserForm"],"mappings":"g3CAsBA,SAAwBA,IAAa,CACnC,KAAM,CAAE,CAAA,EAAMC,EAAe,OAAO,EAC9B,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EACnCC,EAAWC,IACX,CAAE,MAAAC,GAAUC,IACZC,EAAWC,EAA4B,CAAE,KAAM,UAAY,CAAA,EAC3D,CAACC,EAAaC,CAAc,EAAIC,EAAA,SAAgC,CAAE,CAAA,EAElEC,EAAO,MAAOC,GAAiC,CAC/C,GAAA,CACF,MAAMC,EAAc,MAAMC,EAAY,MAAM,OAAO,CACjD,GAAGF,EACH,SAAUA,EAAS,UAAU,KAAK,EAClC,OAAQJ,EAAY,IAAKO,GAAUA,EAAM,IAAK,EAC9C,QAAS,EAAA,CACV,EAEDhB,EAAS,EAAE,aAAa,EAAGiB,EAAa,OAAO,EACtCd,EAAAe,EAAO,CAAE,GAAIJ,EAAY,GAAI,MAAAT,EAAO,IAAK,UAAY,CAAA,CAAC,QACxDc,EAAO,CACVC,EAAmBD,CAAK,EACjBlB,EAAAoB,EAAyBF,CAAK,EAAGA,CAAK,EAE/ClB,EAAS,wBAAyBkB,CAAK,CAE3C,CAAA,EAGF,OAEIG,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACC,EAAA,CACC,SAAU,EAAE,YAAY,EACxB,UAAU,yBAAA,CACZ,EACAD,EAAA,IAACE,EAAY,CAAA,QAAQ,QAAQ,UAAU,WACrC,SAACF,EAAAA,IAAAG,EAAA,CACC,SAACH,EAAA,IAAAI,EAAA,CAAc,GAAGrB,EAChB,eAACmB,EAAY,CAAA,QAAQ,QACnB,SAAAF,EAAA,IAACK,EAAS,CAAA,eAAgBnB,EAAgB,KAAAE,CAAY,CAAA,CACxD,CAAA,CACF,CAAA,CACF,CAAA,EACF,CACF,CAAA,CAAA,CAEJ"}