Refactor authentication flow and improve code organization

The update implemented a redirect functionality in the multi-factor authentication flow for a better user experience. It also involved a refactoring of some parts of the code, substituting direct routing paths with path configs for easier future modifications. Import statements were adjusted for better code organization and readability.
This commit is contained in:
giancarlo
2024-03-27 15:07:15 +08:00
parent f0883c19ef
commit 7579ee9a2c
33 changed files with 103 additions and 151 deletions

View File

@@ -36,7 +36,7 @@ import {
TableRow,
} from '../shadcn/table';
import { cn } from '../utils';
import Trans from './trans';
import { Trans } from './trans';
interface ReactTableProps<T extends object> {
data: T[];

View File

@@ -49,6 +49,11 @@ export const ImageUploadInput = forwardRef<React.ElementRef<'input'>, Props>(
if (files?.length) {
const file = files[0];
if (!file) {
return;
}
const data = URL.createObjectURL(file);
setState({

View File

@@ -14,7 +14,7 @@ export default function isRouteActive(
depth: number,
) {
// we remove any eventual query param from the route's URL
const currentRoutePath = currentRoute.split('?')[0];
const currentRoutePath = currentRoute.split('?')[0] ?? '';
if (!isRoot(currentRoutePath) && isRoot(targetLink)) {
return false;

View File

@@ -2,7 +2,7 @@ import { forwardRef } from 'react';
import Image from 'next/image';
import { cn } from '../../shadcn';
import { cn } from '../../utils';
import { LazyRender } from '../lazy-render';
const NextImage: React.FC<{

View File

@@ -2,6 +2,7 @@ import type { MDXComponents } from 'mdx/types';
import { getMDXComponent } from 'next-contentlayer/hooks';
import Components from './mdx-components';
// @ts-ignore
import styles from './mdx-renderer.module.css';
export function Mdx({