Router: add more 404s.

master
Tom Hacohen 4 years ago
parent 58533f165d
commit d464040d8e

@ -19,7 +19,7 @@ import Calendar from "./Calendar";
import Event from "./Event"; import Event from "./Event";
import LoadingIndicator from "../widgets/LoadingIndicator"; import LoadingIndicator from "../widgets/LoadingIndicator";
import EventEdit from "./EventEdit"; import EventEdit from "./EventEdit";
import PageNotFound from "../PageNotFound"; import PageNotFound, { PageNotFoundRoute } from "../PageNotFound";
import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemDelete, itemSave } from "../Pim/helpers"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemDelete, itemSave } from "../Pim/helpers";
import { historyPersistor } from "../persist-state-history"; import { historyPersistor } from "../persist-state-history";
@ -220,10 +220,12 @@ export default function CalendarsMain() {
</div> </div>
<Event item={item} /> <Event item={item} />
</Route> </Route>
<PageNotFoundRoute />
</Switch> </Switch>
); );
}} }}
/> />
<PageNotFoundRoute />
</Switch> </Switch>
); );
} }

@ -18,7 +18,7 @@ import SearchableAddressBook from "./SearchableAddressBook";
import Contact from "./Contact"; import Contact from "./Contact";
import LoadingIndicator from "../widgets/LoadingIndicator"; import LoadingIndicator from "../widgets/LoadingIndicator";
import ContactEdit from "./ContactEdit"; import ContactEdit from "./ContactEdit";
import PageNotFound from "../PageNotFound"; import PageNotFound, { PageNotFoundRoute } from "../PageNotFound";
import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers";
@ -183,10 +183,12 @@ export default function ContactsMain() {
</div> </div>
<Contact item={item} /> <Contact item={item} />
</Route> </Route>
<PageNotFoundRoute />
</Switch> </Switch>
); );
}} }}
/> />
<PageNotFoundRoute />
</Switch> </Switch>
); );
} }

@ -2,13 +2,26 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import * as React from "react"; import * as React from "react";
import { Route } from "react-router";
import Container from "./widgets/Container"; import Container from "./widgets/Container";
export default function PageNotFound() { export function PageNotFoundRoute(props: { container?: boolean }) {
return ( return (
<Route path="*">
{props.container ? (
<Container> <Container>
<h1>404 Page Not Found</h1> <PageNotFound />
</Container> </Container>
) : (
<PageNotFound />
)}
</Route>
);
}
export default function PageNotFound() {
return (
<h1>404 Page Not Found</h1>
); );
} }

@ -27,6 +27,7 @@ import { StoreState } from "./store";
import { performSync } from "./store/actions"; import { performSync } from "./store/actions";
import { useCredentials } from "./credentials"; import { useCredentials } from "./credentials";
import PimNavigationTabs from "./Pim/NavigationTabs"; import PimNavigationTabs from "./Pim/NavigationTabs";
import { PageNotFoundRoute } from "./PageNotFound";
export default function SyncGate() { export default function SyncGate() {
const etebase = useCredentials(); const etebase = useCredentials();
@ -98,6 +99,7 @@ export default function SyncGate() {
<TasksMain /> <TasksMain />
</Container> </Container>
</Route> </Route>
<PageNotFoundRoute container />
</Switch> </Switch>
</Route> </Route>
<Route <Route
@ -119,6 +121,7 @@ export default function SyncGate() {
<Debug /> <Debug />
)} )}
/> />
<PageNotFoundRoute container />
</Switch> </Switch>
); );
} }

@ -18,7 +18,7 @@ import TaskList from "./TaskList";
import Task from "./Task"; import Task from "./Task";
import LoadingIndicator from "../widgets/LoadingIndicator"; import LoadingIndicator from "../widgets/LoadingIndicator";
import TaskEdit from "./TaskEdit"; import TaskEdit from "./TaskEdit";
import PageNotFound from "../PageNotFound"; import PageNotFound, { PageNotFoundRoute } from "../PageNotFound";
import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers";
@ -185,10 +185,12 @@ export default function TasksMain() {
</div> </div>
<Task item={item} /> <Task item={item} />
</Route> </Route>
<PageNotFoundRoute />
</Switch> </Switch>
); );
}} }}
/> />
<PageNotFoundRoute />
</Switch> </Switch>
); );
} }

Loading…
Cancel
Save