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:
parent
6ca03413be
commit
acde45f534
1 changed files with 12 additions and 4 deletions
|
@ -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} />
|
||||
|
|
Loading…
Add table
Reference in a new issue