0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

refactor(console): buildDetailsLink in api resources page (#355)

This commit is contained in:
Xiao Yijun 2022-03-11 12:10:04 +08:00 committed by GitHub
parent 6ca03413be
commit acde45f534
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,8 @@ import { RequestError } from '@/swr';
import CreateForm from './components/CreateForm';
import * as styles from './index.module.scss';
const buildDetailsLink = (id: string) => `/api-resources/${id}`;
const ApiResources = () => {
const [isCreateFormOpen, setIsCreateFormOpen] = useState(false);
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
@ -47,7 +49,7 @@ const ApiResources = () => {
if (createdApiResource) {
void mutate(conditional(data && [...data, createdApiResource]));
navigate(createdApiResource.id);
navigate(buildDetailsLink(createdApiResource.id));
}
}}
/>
@ -72,9 +74,15 @@ const ApiResources = () => {
</tr>
)}
{data?.map(({ id, name, indicator }) => (
<tr key={id} className={styles.clickable}>
<td className={styles.apiResourceName}>
<ItemPreview title={name} icon={<ImagePlaceholder />} to={`/api-resources/${id}`} />
<tr
key={id}
className={styles.clickable}
onClick={() => {
navigate(buildDetailsLink(id));
}}
>
<td>
<ItemPreview title={name} icon={<ImagePlaceholder />} to={buildDetailsLink(id)} />
</td>
<td>
<CopyToClipboard value={indicator} />