mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
add willCreateTokenFromList event
This commit is contained in:
parent
3c8b4fd747
commit
5c0c26343a
@ -41,16 +41,16 @@ const ApiTokenCreateView = () => {
|
||||
const { trackUsage } = useTracking();
|
||||
const trackUsageRef = useRef(trackUsage);
|
||||
|
||||
useEffect(() => {
|
||||
trackUsageRef.current('didEditTokenFromList');
|
||||
}, []);
|
||||
|
||||
const {
|
||||
params: { id },
|
||||
} = useRouteMatch('/settings/api-tokens/:id');
|
||||
|
||||
const isCreating = id === 'create';
|
||||
|
||||
useEffect(() => {
|
||||
trackUsageRef.current(isCreating ? 'didCreateTokenFromList' : 'didEditTokenFromList');
|
||||
}, [isCreating]);
|
||||
|
||||
if (history.location.state?.apiToken.accessKey) {
|
||||
apiToken = history.location.state.apiToken;
|
||||
}
|
||||
|
||||
@ -106,6 +106,7 @@ const ApiTokenListView = () => {
|
||||
data-testid="create-api-token-button"
|
||||
startIcon={<Plus />}
|
||||
size="L"
|
||||
onClick={() => trackUsage('willCreateTokenFromList')}
|
||||
to="/settings/api-tokens/create"
|
||||
>
|
||||
{formatMessage({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user