import * as Yup from "yup"; import { forwardRef, useImperativeHandle, useState } from "react"; import PropTypes from "prop-types"; import { Formik, Form } from "formik"; import accountsService from "../../services/accountsService"; import { Alert } from "../Alert"; import { Button } from "../Button"; import { CopyButton } from "../CopyButton"; import { TextField } from "../Form/TextField"; import { CircledProgressIcon, PlusIcon } from "../Icons"; const newAPIKeySchema = Yup.object().shape({ name: Yup.string(), }); const State = { Pure: "PURE", Success: "SUCCESS", Failure: "FAILURE", }; export const APIKeyType = { Public: "public", General: "general", }; export const AddAPIKeyForm = forwardRef(({ onSuccess, type }, ref) => { const [state, setState] = useState(State.Pure); const [generatedKey, setGeneratedKey] = useState(null); useImperativeHandle(ref, () => ({ reset: () => setState(State.Pure), })); return (
Please copy your new API key below. We'll never show it again!
{generatedKey}