mirror of
https://github.com/strapi/strapi.git
synced 2025-12-29 16:16:20 +00:00
fix code style
This commit is contained in:
parent
671034d67a
commit
b327d81410
@ -27,13 +27,9 @@ const DeleteButton = ({ tokenName, onClick }) => {
|
||||
);
|
||||
};
|
||||
|
||||
DeleteButton.defaultProps = {
|
||||
onClick: () => {},
|
||||
};
|
||||
|
||||
DeleteButton.propTypes = {
|
||||
tokenName: PropTypes.string.isRequired,
|
||||
onClick: PropTypes.func,
|
||||
onClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default DeleteButton;
|
||||
|
||||
@ -2,21 +2,21 @@ import React from 'react';
|
||||
import { Text } from '@strapi/parts/Text';
|
||||
import { Tbody, Tr, Td } from '@strapi/parts/Table';
|
||||
import { Row } from '@strapi/parts/Row';
|
||||
import { RelativeTime } from '@strapi/helper-plugin';
|
||||
import { RelativeTime, useQueryParams } from '@strapi/helper-plugin';
|
||||
import { useIntl } from 'react-intl';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import DeleteButton from './DeleteButton';
|
||||
import UpdateButton from './UpdateButton';
|
||||
|
||||
const TableRows = ({ canDelete, canUpdate, onClickDelete, withBulkActions, rows }) => {
|
||||
const { formatMessage } = useIntl();
|
||||
const { search } = useLocation();
|
||||
const [{ query }] = useQueryParams();
|
||||
const [, sortOrder] = query.sort.split(':');
|
||||
|
||||
const apiTokens = rows.sort((a, b) => {
|
||||
const comparaison = a.name.localeCompare(b.name);
|
||||
|
||||
return search.endsWith('DESC') ? -comparaison : comparaison;
|
||||
return sortOrder === 'DESC' ? -comparaison : comparaison;
|
||||
});
|
||||
|
||||
return (
|
||||
@ -25,17 +25,17 @@ const TableRows = ({ canDelete, canUpdate, onClickDelete, withBulkActions, rows
|
||||
return (
|
||||
<Tr key={apiToken.id}>
|
||||
<Td key="name">
|
||||
<Text textColor="Neutral800" bold>
|
||||
<Text textColor="neutral800" bold>
|
||||
{apiToken.name}
|
||||
</Text>
|
||||
</Td>
|
||||
<Td key="description">
|
||||
<Text textColor="Neutral800" ellipsis>
|
||||
<Text textColor="neutral800" ellipsis>
|
||||
{apiToken.description}
|
||||
</Text>
|
||||
</Td>
|
||||
<Td key="type">
|
||||
<Text textColor="Neutral800">
|
||||
<Text textColor="neutral800">
|
||||
{formatMessage({
|
||||
id: `Settings.apiTokens.types.${apiToken.type}`,
|
||||
defaultMessage: 'Type unknown',
|
||||
@ -43,7 +43,7 @@ const TableRows = ({ canDelete, canUpdate, onClickDelete, withBulkActions, rows
|
||||
</Text>
|
||||
</Td>
|
||||
<Td key="createdAt">
|
||||
<Text textColor="Neutral800">
|
||||
<Text textColor="neutral800">
|
||||
<RelativeTime timestamp={new Date(apiToken.createdAt)} />
|
||||
</Text>
|
||||
</Td>
|
||||
|
||||
@ -16,10 +16,10 @@ import AddIcon from '@strapi/icons/AddIcon';
|
||||
import { useQuery } from 'react-query';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import qs from 'qs';
|
||||
import TableRows from './DynamicTable';
|
||||
import { axiosInstance } from '../../../../../core/utils';
|
||||
import adminPermissions from '../../../../../permissions';
|
||||
import tableHeaders from './utils/tableHeaders';
|
||||
import TableRows from './DynamicTable';
|
||||
|
||||
const ApiTokenListView = () => {
|
||||
useFocusWhenNavigate();
|
||||
@ -44,7 +44,7 @@ const ApiTokenListView = () => {
|
||||
return data;
|
||||
},
|
||||
{
|
||||
enabled: !!canRead,
|
||||
enabled: canRead,
|
||||
onError: () => {
|
||||
toggleNotification({
|
||||
type: 'warning',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user