Skip to content

Commit b7e8185

Browse files
Adjusted onDisable function
1 parent ab545ba commit b7e8185

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/web/components/ApiKeyManagement/KeyItem.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ type KeyItemProps = {
1717
function KeyItem({ apiKey: apiKeyInitial, onEdit, onDisable, availableRoles }: KeyItemProps) {
1818
const [apiKey, setApiKey] = useState<ApiKeyDTO>(apiKeyInitial);
1919

20+
if (apiKey.disabled) {
21+
return <div />;
22+
}
23+
2024
return (
2125
<tr>
2226
<td>{apiKey.name}</td>
2327
<td>{apiKey.key_id}</td>
2428
<td>
2529
<ApiRolesCell apiRoles={apiKey.roles} />
2630
</td>
27-
<td>{apiKey.disabled ? 'DISABLE' : formatUnixDate(apiKey.created)}</td>
31+
<td>{formatUnixDate(apiKey.created)}</td>
2832
<td>
2933
<KeyEditDialog
3034
apiKey={apiKey}

src/web/screens/apiKeyManagement.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ function ApiKeyManagement() {
5757
}
5858
};
5959

60-
const onKeyDisable: OnApiKeyDisable = async (apikey, setApiKey) => {
60+
const onKeyDisable: OnApiKeyDisable = async (apiKey, setApiKey) => {
6161
try {
62-
await DisableApiKey(apikey);
62+
await DisableApiKey(apiKey);
6363
setApiKey((oldApiKey) => {
6464
const newApiKey = { ...oldApiKey };
6565
newApiKey.disabled = true;
6666
return newApiKey;
6767
});
68-
setStatusPopup({ message: 'Your key has been Disabled', type: 'Success' });
68+
setStatusPopup({ message: 'Your key has been disabled', type: 'Success' });
6969
setShowStatusPopup(true);
7070
} catch (e) {
7171
handleErrorPopup(e, setStatusPopup, setShowStatusPopup);

0 commit comments

Comments
 (0)