fix: prevent saving API key with empty name (#18970)
Fixes: #18959 Generally, users need to type name before they create the api key. https://github.com/user-attachments/assets/bb3ec0ec-d05f-48a8-b762-a35288a9e111 <img width="656" height="559" alt="image" src="https://github.com/user-attachments/assets/cb8fd461-98f0-4475-b3f0-0de1e62624e2" />
This commit is contained in:
+6
-2
@@ -4,9 +4,10 @@ import {
|
||||
} from '@/settings/developers/utils/formatExpiration';
|
||||
import { TableCell } from '@/ui/layout/table/components/TableCell';
|
||||
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||
import { IconChevronRight } from 'twenty-ui/display';
|
||||
import { styled } from '@linaria/react';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useContext } from 'react';
|
||||
import { IconChevronRight } from 'twenty-ui/display';
|
||||
import { ThemeContext } from 'twenty-ui/theme-constants';
|
||||
import { type ApiKey } from '~/generated-metadata/graphql';
|
||||
|
||||
@@ -29,6 +30,7 @@ export const SettingsApiKeysFieldItemTableRow = ({
|
||||
apiKey,
|
||||
to,
|
||||
}: SettingsApiKeysFieldItemTableRowProps) => {
|
||||
const { t } = useLingui();
|
||||
const { theme } = useContext(ThemeContext);
|
||||
const formattedExpiration = formatExpiration(apiKey.expiresAt || null);
|
||||
|
||||
@@ -43,7 +45,9 @@ export const SettingsApiKeysFieldItemTableRow = ({
|
||||
textOverflow="ellipsis"
|
||||
clickable
|
||||
>
|
||||
<StyledEllipsisLabel>{apiKey.name}</StyledEllipsisLabel>
|
||||
<StyledEllipsisLabel>
|
||||
{apiKey.name || t`Unnamed API Key`}
|
||||
</StyledEllipsisLabel>
|
||||
</TableCell>
|
||||
|
||||
<TableCell
|
||||
|
||||
Reference in New Issue
Block a user