mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 00:09:18 +00:00
add tokenType to the didCreateToken and didEditToken events in API e Transfer tokens
This commit is contained in:
parent
880ba7af86
commit
3182bba15c
@ -0,0 +1,2 @@
|
||||
export const API_TOKEN_TYPE = 'api-token';
|
||||
export const TRANSFER_TOKEN_TYPE = 'transfer-token';
|
@ -28,6 +28,7 @@ import Permissions from './components/Permissions';
|
||||
import FormApiTokenContainer from './components/FormApiTokenContainer';
|
||||
import TokenBox from '../../../components/Tokens/TokenBox';
|
||||
import FormHead from '../../../components/Tokens/FormHead';
|
||||
import { API_TOKEN_TYPE } from '../../../components/Tokens/constants';
|
||||
|
||||
const MSG_ERROR_NAME_TAKEN = 'Name already taken';
|
||||
|
||||
@ -201,6 +202,7 @@ const ApiTokenCreateView = () => {
|
||||
|
||||
trackUsageRef.current(isCreating ? 'didCreateToken' : 'didEditToken', {
|
||||
type: apiToken.type,
|
||||
tokenType: API_TOKEN_TYPE,
|
||||
});
|
||||
} catch (err) {
|
||||
const errors = formatAPIErrors(err.response.data);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useRef } from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { Formik } from 'formik';
|
||||
import { useRouteMatch, useHistory } from 'react-router-dom';
|
||||
@ -9,6 +9,7 @@ import {
|
||||
Form,
|
||||
useOverlayBlocker,
|
||||
useNotification,
|
||||
useTracking,
|
||||
useGuidedTour,
|
||||
useRBAC,
|
||||
useFetchClient,
|
||||
@ -23,6 +24,7 @@ import adminPermissions from '../../../../../permissions';
|
||||
import FormTransferTokenContainer from './components/FormTransferTokenContainer';
|
||||
import TokenBox from '../../../components/Tokens/TokenBox';
|
||||
import FormHead from '../../../components/Tokens/FormHead';
|
||||
import { TRANSFER_TOKEN_TYPE } from '../../../components/Tokens/constants';
|
||||
|
||||
const MSG_ERROR_NAME_TAKEN = 'Name already taken';
|
||||
|
||||
@ -39,6 +41,8 @@ const TransferTokenCreateView = () => {
|
||||
}
|
||||
: null
|
||||
);
|
||||
const { trackUsage } = useTracking();
|
||||
const trackUsageRef = useRef(trackUsage);
|
||||
const { setCurrentStep } = useGuidedTour();
|
||||
const {
|
||||
allowedActions: { canCreate, canUpdate, canRegenerate },
|
||||
@ -119,6 +123,11 @@ const TransferTokenCreateView = () => {
|
||||
defaultMessage: 'Transfer Token successfully edited',
|
||||
}),
|
||||
});
|
||||
|
||||
trackUsageRef.current(isCreating ? 'didCreateToken' : 'didEditToken', {
|
||||
type: transferToken.type,
|
||||
tokenType: TRANSFER_TOKEN_TYPE,
|
||||
});
|
||||
} catch (err) {
|
||||
const errors = formatAPIErrors(err.response.data);
|
||||
actions.setErrors(errors);
|
||||
|
Loading…
x
Reference in New Issue
Block a user