0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

fix: add not found if package is missing

This commit is contained in:
Juan Picado @jotadeveloper 2019-03-24 23:20:30 +01:00
parent 86dd30313e
commit 4da21c1490
No known key found for this signature in database
GPG key ID: 18AC54485952D158

View file

@ -10,6 +10,7 @@ import DetailContainer from '../../components/DetailContainer';
import DetailSidebar from '../../components/DetailSidebar'; import DetailSidebar from '../../components/DetailSidebar';
import { callDetailPage } from '../../utils/calls'; import { callDetailPage } from '../../utils/calls';
import { getRouterPackageName } from '../../utils/package'; import { getRouterPackageName } from '../../utils/package';
import NotFound from '../../components/NotFound';
export const DetailContext = React.createContext(); export const DetailContext = React.createContext();
@ -105,7 +106,11 @@ class VersionPage extends Component<any, any> {
render() { render() {
const { isLoading, packageMeta, readMe, packageName } = this.state; const { isLoading, packageMeta, readMe, packageName } = this.state;
if (isLoading === false) { if (isLoading) {
return <Loading />;
} else if (!packageMeta) {
return <NotFound />;
} else {
return ( return (
<DetailContextProvider value={{ packageMeta, readMe, packageName, enableLoading: this.enableLoading }}> <DetailContextProvider value={{ packageMeta, readMe, packageName, enableLoading: this.enableLoading }}>
<Grid className={'container content'} container={true} spacing={0}> <Grid className={'container content'} container={true} spacing={0}>
@ -118,8 +123,6 @@ class VersionPage extends Component<any, any> {
</Grid> </Grid>
</DetailContextProvider> </DetailContextProvider>
); );
} else {
return <Loading />;
} }
} }