diff --git a/src/layout/index.tsx b/src/layout/index.tsx index ecb96c6..944cf3d 100644 --- a/src/layout/index.tsx +++ b/src/layout/index.tsx @@ -39,9 +39,13 @@ const Layout: React.FC> = (props) => { }; const topicDetailRegx = /\/topic\/([a-f0-9]){24}/g; + const userDetailRegx = /\/user\/(.*)/g; - if (location.pathname.match(topicDetailRegx)) { - const topicBreadcrumbName = location.pathname.split('/').pop(); + if ( + location.pathname.match(topicDetailRegx) || + location.pathname.match(userDetailRegx) + ) { + const currentBreadcrumbName = location.pathname.split('/').pop(); headerConfig = { title: null, @@ -56,30 +60,7 @@ const Layout: React.FC> = (props) => { }, { path: location.pathname, - breadcrumbName: topicBreadcrumbName, - }, - ], - }, - }; - } - - if (location.pathname.match(/\/user\/(.*)/g)) { - const loginname = location.pathname.split('/').pop(); - - headerConfig = { - title: null, - breadcrumb: { - itemRender: (route: { path: string; breadcrumbName: string }) => { - return {route.breadcrumbName}; - }, - routes: [ - { - path: '/', - breadcrumbName: '主页', - }, - { - path: location.pathname, - breadcrumbName: loginname, + breadcrumbName: currentBreadcrumbName, }, ], }, diff --git a/src/service/topic.ts b/src/service/topic.ts index 79634f8..e9308f7 100644 --- a/src/service/topic.ts +++ b/src/service/topic.ts @@ -37,20 +37,6 @@ export const postTopic = async (data: { return request(`${BASE_URL}/api/v1/topics`, options); }; -export const postTopic = async (data: { - title: string; - tab: string; - content: string; - accesstoken: string; -}) => { - const options: any = { - method: 'POST', - data, - }; - - return request(`${BASE_URL}/api/v1/topics`, options); -}; - export const queryTopicDetail = async (params: { id: string; mdrender?: boolean;