mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Handle Admin page 404
This commit is contained in:
parent
9a2e051361
commit
63c5c73aee
@ -60,6 +60,18 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
if (includes(nextProps.location.pathname, 'plugins') && nextProps.location.pathname !== '/list-plugins') {
|
||||
const appPlugins = Object.keys(nextProps.plugins.toJS());
|
||||
const pluginPath = nextProps.location.pathname.split('/')[2];
|
||||
const shouldRedirect = appPlugins.filter(el => el === pluginPath).length === 0;
|
||||
|
||||
if (shouldRedirect) {
|
||||
this.props.history.push('/404');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkLogin = (props) => {
|
||||
if (props.hasUserPlugin && this.isUrlProtected(props) && !auth.getToken()) {
|
||||
const endPoint = this.hasAdminUser(props) ? 'login': 'register';
|
||||
@ -122,6 +134,7 @@ export class AdminPage extends React.Component { // eslint-disable-line react/pr
|
||||
<Route path="/install-plugin" component={ComingSoonPage} exact />
|
||||
<Route path="/configuration" component={ComingSoonPage} exact />
|
||||
<Route path="" component={NotFoundPage} />
|
||||
<Route path="404" component={NotFoundPage} />
|
||||
</Switch>
|
||||
</Content>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user