/* eslint-disable no-alert */ import React, { useContext, useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { Table, TableHead, TableBody, TableRow, TableCell, IconButton, } from '@material-ui/core'; import { Delete } from '@material-ui/icons'; import { Alert } from '@material-ui/lab'; import { formatFullDateTimeWithLocale } from '../../../component/common/util'; import CreateApiKey from './api-key-create'; import Secret from './secret'; import ConditionallyRender from '../../../component/common/ConditionallyRender/ConditionallyRender'; import Dialogue from '../../../component/common/Dialogue/Dialogue'; import AccessContext from '../../../contexts/AccessContext'; import { DELETE_API_TOKEN, CREATE_API_TOKEN, } from '../../../component/AccessProvider/permissions'; import PageContent from '../../../component/common/PageContent'; import HeaderTitle from '../../../component/common/HeaderTitle'; function ApiKeyList({ location, fetchApiKeys, removeKey, addKey, keys, unleashUrl, }) { const [show, setShow] = useState(false); const { hasAccess } = useContext(AccessContext); const [showDelete, setShowDelete] = useState(false); const [delKey, setDelKey] = useState(undefined); const deleteKey = async () => { await removeKey(delKey); setDelKey(undefined); setShowDelete(false); }; useEffect(() => { fetchApiKeys(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( } /> } /> } >

Read the{' '} Getting started guide {' '} to learn how to connect to the Unleash API from your application or programmatically. Please note it can take up to 1 minute before a new API key is activated.


API URL: {' '}
{unleashUrl}/api/



Created Username Access Type Secret Action {keys.map(item => ( {formatFullDateTimeWithLocale( item.createdAt, location.locale )} {item.username} {item.type} { setDelKey(item.secret); setShowDelete(true); }} > } /> ))}
{ setShowDelete(false); setDelKey(undefined); }} title="Really delete API key?" >
Are you sure you want to delete?
); } ApiKeyList.propTypes = { location: PropTypes.object, fetchApiKeys: PropTypes.func.isRequired, removeKey: PropTypes.func.isRequired, addKey: PropTypes.func.isRequired, keys: PropTypes.array.isRequired, unleashUrl: PropTypes.string, }; export default ApiKeyList;