From 53501a369205a2e328302c12142f3ceaa846003e Mon Sep 17 00:00:00 2001 From: robin Date: Wed, 2 Nov 2022 13:15:52 +0800 Subject: [PATCH] Revert "Fix RouteNode type error" --- ui/src/router/index.tsx | 3 +-- ui/src/router/route-config.ts | 7 ++++++- ui/src/router/types.ts | 14 -------------- 3 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 ui/src/router/types.ts diff --git a/ui/src/router/index.tsx b/ui/src/router/index.tsx index 7f2f0d3e..99d44723 100644 --- a/ui/src/router/index.tsx +++ b/ui/src/router/index.tsx @@ -2,10 +2,9 @@ import React, { Suspense, lazy } from 'react'; import { RouteObject, createBrowserRouter } from 'react-router-dom'; import Layout from '@answer/pages/Layout'; -import routeConfig from '@/router/route-config'; +import routeConfig, { RouteNode } from '@/router/route-config'; import RouteRules from '@/router/route-rules'; -import { RouteNode } from '@/router/types'; const routes: RouteObject[] = []; diff --git a/ui/src/router/route-config.ts b/ui/src/router/route-config.ts index 0eb31651..2e46ffbe 100644 --- a/ui/src/router/route-config.ts +++ b/ui/src/router/route-config.ts @@ -1,5 +1,10 @@ -import { RouteNode } from '@/router/types'; +import { RouteObject } from 'react-router-dom'; +export interface RouteNode extends RouteObject { + page: string; + children?: RouteNode[]; + rules?: string[]; +} const routeConfig: RouteNode[] = [ { path: '/', diff --git a/ui/src/router/types.ts b/ui/src/router/types.ts deleted file mode 100644 index f0d13c87..00000000 --- a/ui/src/router/types.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IndexRouteObject, NonIndexRouteObject } from 'react-router-dom'; - -type CustomRouteObject = { - page: string; - rules?: string[]; -}; - -type IndexRouteNode = IndexRouteObject & CustomRouteObject; - -interface NonIndexRouteNode extends NonIndexRouteObject, CustomRouteObject { - children?: (IndexRouteNode | NonIndexRouteNode)[]; -} - -export type RouteNode = IndexRouteNode | NonIndexRouteNode;