0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): correct tab nav link on the audit-logs details page (#2543)

This commit is contained in:
Xiao Yijun 2022-11-29 11:24:52 +08:00 committed by GitHub
parent 356a77e70c
commit a9d607658d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,9 @@ import * as styles from './index.module.scss';
const getAuditLogDetailsRelatedResourceLink = (pathname: string) =>
`/${pathname.slice(0, pathname.lastIndexOf('/'))}`;
const getDetailsTabNavLink = (logId: string, userId?: string) =>
userId ? `/users/${userId}/logs/${logId}` : `/audit-logs/${logId}`;
const AuditLogDetails = () => {
const { userId, logId } = useParams();
const { pathname } = useLocation();
@ -42,6 +45,10 @@ const AuditLogDetails = () => {
'log_details.back_to_logs'
);
if (!logId) {
return null;
}
return (
<div className={detailsStyles.container}>
<LinkButton to={backLink} icon={<Back />} title={backLinkTitle} className={styles.backLink} />
@ -96,7 +103,7 @@ const AuditLogDetails = () => {
</div>
</Card>
<TabNav>
<TabNavItem href={`/audit-logs/${logId ?? ''}`}>
<TabNavItem href={getDetailsTabNavLink(logId, userId)}>
{t('log_details.tab_details')}
</TabNavItem>
</TabNav>