mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
69e8aac4f1
* Move 'Api Keys' listing to filterable table * Add context menu Allow copying new keys
22 lines
615 B
TypeScript
22 lines
615 B
TypeScript
import { useMemo } from "react";
|
|
import {
|
|
copyApiKeyFactory,
|
|
revokeApiKeyFactory,
|
|
} from "~/actions/definitions/apiKeys";
|
|
import type ApiKey from "~/models/ApiKey";
|
|
import { useMenuAction } from "~/hooks/useMenuAction";
|
|
|
|
/**
|
|
* Hook that constructs the action menu for API key operations.
|
|
*
|
|
* @param apiKey - the API key to build actions for.
|
|
* @returns action with children for use in menus.
|
|
*/
|
|
export function useApiKeyMenuActions(apiKey: ApiKey) {
|
|
const actions = useMemo(
|
|
() => [copyApiKeyFactory({ apiKey }), revokeApiKeyFactory({ apiKey })],
|
|
[apiKey]
|
|
);
|
|
return useMenuAction(actions);
|
|
}
|