Skip to content

Commit 53de6e8

Browse files
authored
fix: Modify header show condition (#464)
1 parent eb56624 commit 53de6e8

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/components/Header/index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class Header extends Component {
2525
};
2626

2727
onSearch = async value => {
28-
const { appStore } = this.props;
29-
this.props.history.push('/store/search/' + value);
28+
const { appStore, history, isHome } = this.props;
29+
const pushUrl = isHome ? `/apps/search/${value}` : `/store/search/${value}`;
30+
this.props.history.push(pushUrl);
3031
await appStore.fetchAll({ search_word: value });
3132
appStore.homeApps = appStore.apps;
3233
};
@@ -149,7 +150,7 @@ class Header extends Component {
149150
<div className={styles.wrapper}>
150151
<Logo className={styles.logo} url={logoUrl} />
151152
<div className={styles.menuOuter}>
152-
{isNormal && this.renderMenus()}
153+
{isNormal && !isHome && this.renderMenus()}
153154
{this.renderMenuBtns()}
154155
</div>
155156
{needShowSearch && (

src/routes/renderRoute.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ import { getCookie, setCookie } from '../utils';
99

1010
const renderRoute = (match, route, store) => {
1111
if (route.path === 'login') {
12-
setCookie('user', '', -1);
13-
setCookie('role', '', -1);
12+
const names = [
13+
'access_token',
14+
'token_type',
15+
'access_token_home',
16+
'refresh_token',
17+
'user',
18+
'role'
19+
];
20+
names.forEach(name => setCookie(name, '', -1));
1421
}
1522

1623
const user = store.user || {};
@@ -29,7 +36,7 @@ const renderRoute = (match, route, store) => {
2936
const component = withRouter(route.component);
3037

3138
if (route.path !== '/login') {
32-
const isHome = route.path === '/' || route.path === '/apps/:appId';
39+
const isHome = route.path === '/' || route.path.startsWith('/apps/');
3340

3441
return (
3542
<Fragment>

0 commit comments

Comments
 (0)