2022-11-03 14:06:26 +00:00
|
|
|
import { Form } from "@patternfly/react-core";
|
|
|
|
import { useForm } from "react-hook-form";
|
|
|
|
import { useTranslation } from "react-i18next";
|
2022-10-10 10:14:19 +00:00
|
|
|
|
2023-02-07 11:29:30 +00:00
|
|
|
import { TextControl } from "ui-shared";
|
2023-01-16 10:23:07 +00:00
|
|
|
import { getPersonalInfo } from "../api/methods";
|
|
|
|
import { UserRepresentation } from "../api/representations";
|
2022-11-03 14:06:26 +00:00
|
|
|
import { Page } from "../components/page/Page";
|
|
|
|
import { usePromise } from "../utils/usePromise";
|
|
|
|
|
|
|
|
const PersonalInfo = () => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const { control, reset } = useForm<UserRepresentation>({
|
|
|
|
mode: "onChange",
|
|
|
|
});
|
|
|
|
|
2023-01-16 10:23:07 +00:00
|
|
|
usePromise((signal) => getPersonalInfo({ signal }), reset);
|
2022-11-03 14:06:26 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Page title={t("personalInfo")} description={t("personalInfoDescription")}>
|
|
|
|
<Form isHorizontal>
|
|
|
|
<TextControl
|
|
|
|
control={control}
|
|
|
|
name="username"
|
|
|
|
rules={{ maxLength: 254, required: true }}
|
|
|
|
label={t("username")}
|
|
|
|
/>
|
|
|
|
<TextControl
|
|
|
|
control={control}
|
|
|
|
name="firstName"
|
|
|
|
label={t("firstName")}
|
|
|
|
/>
|
|
|
|
<TextControl control={control} name="lastName" label={t("lastName")} />
|
|
|
|
</Form>
|
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
};
|
2022-10-10 10:14:19 +00:00
|
|
|
|
|
|
|
export default PersonalInfo;
|