diff --git a/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx b/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx index bc12e6fc1f..b3b168bff6 100644 --- a/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx +++ b/apps/web/ee/components/apiKeys/ApiKeyDialogForm.tsx @@ -33,9 +33,9 @@ export default function ApiKeyDialogForm(props: { }, } = props; - const [newApiKey, setNewApiKey] = useState(""); + const [apiKey, setApiKey] = useState(""); const [successfulNewApiKeyModal, setSuccessfulNewApiKeyModal] = useState(false); - const [newApiKeyDetails, setNewApiKeyDetails] = useState({ + const [apiKeyDetails, setApiKeyDetails] = useState({ id: "", hashedKey: "", expiresAt: null as Date | null, @@ -54,7 +54,7 @@ export default function ApiKeyDialogForm(props: { <>

- {t("success_api_key_created")} + {apiKeyDetails ? t("success_api_key_edited") : t("success_api_key_created")}

{t("success_api_key_created_bold_tagline")}{" "} @@ -64,12 +64,12 @@ export default function ApiKeyDialogForm(props: {
- {newApiKey} + {apiKey}
- {newApiKeyDetails.neverExpires + {apiKeyDetails.neverExpires ? t("never_expire_key") - : `${t("expires")} ${newApiKeyDetails?.expiresAt?.toLocaleDateString()}`} + : `${t("expires")} ${apiKeyDetails?.expiresAt?.toLocaleDateString()}`}
@@ -95,9 +95,9 @@ export default function ApiKeyDialogForm(props: { & { neverExpires: boolean }> form={form} handleSubmit={async (event) => { - const newApiKey = await utils.client.mutation("viewer.apiKeys.create", event); - setNewApiKey(newApiKey); - setNewApiKeyDetails({ ...event }); + const apiKey = await utils.client.mutation("viewer.apiKeys.create", event); + setApiKey(apiKey); + setApiKeyDetails({ ...event }); await utils.invalidateQueries(["viewer.apiKeys.list"]); setSuccessfulNewApiKeyModal(true); }} @@ -140,7 +140,7 @@ export default function ApiKeyDialogForm(props: { {t("cancel")} diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 5099d0a664..e5944209fb 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -734,6 +734,7 @@ "never_expire_key": "Never expires", "delete_api_key": "Revoke API key", "success_api_key_created": "API key created successfully", + "success_api_key_edited": "API key updated successfully", "create": "Create", "success_api_key_created_bold_tagline": "Save this API key somewhere safe.", "you_will_only_view_it_once": "You will not be able to view it again once you close this modal.",