0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

feat(console): applications list navigation (#341)

This commit is contained in:
Gao Sun 2022-03-08 21:09:32 +08:00 committed by GitHub
parent 4a004cfbb8
commit c46fb704bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@ import { conditional } from '@silverhand/essentials/lib/utilities/conditional.js
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import Modal from 'react-modal'; import Modal from 'react-modal';
import { useNavigate } from 'react-router-dom';
import useSWR from 'swr'; import useSWR from 'swr';
import Button from '@/components/Button'; import Button from '@/components/Button';
@ -23,6 +24,7 @@ const Applications = () => {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const { data, error, mutate } = useSWR<Application[], RequestError>('/api/applications'); const { data, error, mutate } = useSWR<Application[], RequestError>('/api/applications');
const isLoading = !data && !error; const isLoading = !data && !error;
const navigate = useNavigate();
return ( return (
<Card> <Card>
@ -69,7 +71,13 @@ const Applications = () => {
</tr> </tr>
)} )}
{data?.map(({ id, name, type }) => ( {data?.map(({ id, name, type }) => (
<tr key={id}> <tr
key={id}
className={styles.clickable}
onClick={() => {
navigate(`/applications/${id}`);
}}
>
<td> <td>
<ItemPreview <ItemPreview
title={name} title={name}