All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.CreateUser-553684e2.js.map Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
{"version":3,"file":"CreateUser-553684e2.js","sources":["../../src/user/CreateUser.tsx"],"sourcesContent":["import type GroupRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/groupRepresentation\";\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 { UserFormFields, toUserRepresentation } from \"./form-state\";\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 (data: UserFormFields) => {\n    try {\n      const createdUser = await adminClient.users.create({\n        ...toUserRepresentation(data),\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","t","useTranslation","addAlert","addError","useAlerts","navigate","useNavigate","realm","useRealm","userForm","useForm","addedGroups","setAddedGroups","useState","save","data","createdUser","adminClient","toUserRepresentation","group","AlertVariant","toUser","error","isUserProfileError","userProfileErrorToString","jsxs","Fragment","jsx","ViewHeader","PageSection","UserProfileProvider","FormProvider","UserForm"],"mappings":"27CAsBA,SAAwBA,IAAa,CACnC,KAAM,CAAE,EAAAC,CAAA,EAAMC,EAAe,OAAO,EAC9B,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EACnCC,EAAWC,IACX,CAAE,MAAAC,GAAUC,IACZC,EAAWC,EAAwB,CAAE,KAAM,UAAY,CAAA,EACvD,CAACC,EAAaC,CAAc,EAAIC,EAAA,SAAgC,CAAE,CAAA,EAElEC,EAAO,MAAOC,GAAyB,CACvC,GAAA,CACF,MAAMC,EAAc,MAAMC,EAAY,MAAM,OAAO,CACjD,GAAGC,EAAqBH,CAAI,EAC5B,OAAQJ,EAAY,IAAKQ,GAAUA,EAAM,IAAK,EAC9C,QAAS,EAAA,CACV,EAEDjB,EAASF,EAAE,aAAa,EAAGoB,EAAa,OAAO,EACtCf,EAAAgB,EAAO,CAAE,GAAIL,EAAY,GAAI,MAAAT,EAAO,IAAK,UAAY,CAAA,CAAC,QACxDe,EAAO,CACVC,EAAmBD,CAAK,EACjBnB,EAAAqB,EAAyBF,CAAK,EAAGA,CAAK,EAE/CnB,EAAS,wBAAyBmB,CAAK,CAE3C,CAAA,EAGF,OAEIG,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACC,EAAA,CACC,SAAU5B,EAAE,YAAY,EACxB,UAAU,yBAAA,CACZ,EACA2B,EAAA,IAACE,EAAY,CAAA,QAAQ,QAAQ,UAAU,WACrC,SAACF,EAAAA,IAAAG,EAAA,CACC,SAACH,EAAA,IAAAI,EAAA,CAAc,GAAGtB,EAChB,eAACoB,EAAY,CAAA,QAAQ,QACnB,SAAAF,EAAA,IAACK,EAAS,CAAA,eAAgBpB,EAAgB,KAAAE,CAAY,CAAA,CACxD,CAAA,CACF,CAAA,CACF,CAAA,EACF,CACF,CAAA,CAAA,CAEJ"}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy