Skip to content

Commit a929aa3

Browse files
authored
fix: error rebase info (#6)
1 parent 706e647 commit a929aa3

File tree

2 files changed

+7
-40
lines changed

2 files changed

+7
-40
lines changed

src/layout/index.tsx

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ const Layout: React.FC<React.PropsWithChildren<Props>> = (props) => {
3939
};
4040

4141
const topicDetailRegx = /\/topic\/([a-f0-9]){24}/g;
42+
const userDetailRegx = /\/user\/(.*)/g;
4243

43-
if (location.pathname.match(topicDetailRegx)) {
44-
const topicBreadcrumbName = location.pathname.split('/').pop();
44+
if (
45+
location.pathname.match(topicDetailRegx) ||
46+
location.pathname.match(userDetailRegx)
47+
) {
48+
const currentBreadcrumbName = location.pathname.split('/').pop();
4549

4650
headerConfig = {
4751
title: null,
@@ -56,30 +60,7 @@ const Layout: React.FC<React.PropsWithChildren<Props>> = (props) => {
5660
},
5761
{
5862
path: location.pathname,
59-
breadcrumbName: topicBreadcrumbName,
60-
},
61-
],
62-
},
63-
};
64-
}
65-
66-
if (location.pathname.match(/\/user\/(.*)/g)) {
67-
const loginname = location.pathname.split('/').pop();
68-
69-
headerConfig = {
70-
title: null,
71-
breadcrumb: {
72-
itemRender: (route: { path: string; breadcrumbName: string }) => {
73-
return <Link to={route.path}>{route.breadcrumbName}</Link>;
74-
},
75-
routes: [
76-
{
77-
path: '/',
78-
breadcrumbName: '主页',
79-
},
80-
{
81-
path: location.pathname,
82-
breadcrumbName: loginname,
63+
breadcrumbName: currentBreadcrumbName,
8364
},
8465
],
8566
},

src/service/topic.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,6 @@ export const postTopic = async (data: {
3737
return request(`${BASE_URL}/api/v1/topics`, options);
3838
};
3939

40-
export const postTopic = async (data: {
41-
title: string;
42-
tab: string;
43-
content: string;
44-
accesstoken: string;
45-
}) => {
46-
const options: any = {
47-
method: 'POST',
48-
data,
49-
};
50-
51-
return request(`${BASE_URL}/api/v1/topics`, options);
52-
};
53-
5440
export const queryTopicDetail = async (params: {
5541
id: string;
5642
mdrender?: boolean;

0 commit comments

Comments
 (0)