added redirector component (#199)

* added redirector component
    * it will redirect every request to /$something that is not handled otherwise (/intro, /login and such) to /n/$something
* added getNote API Call
* added NotFound component
* added LandingLayout around the NotFound component, so users can easily navigate away from the component

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2020-06-13 00:29:39 +02:00 committed by GitHub
parent 773fc60f07
commit c679f5524c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 85 additions and 0 deletions

View file

@ -4,6 +4,7 @@ import { Provider } from 'react-redux'
import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom'
import { ApplicationLoader } from './components/application-loader/application-loader'
import { Editor } from './components/editor/editor'
import { NotFound } from './components/error/not-found'
import { LandingLayout } from './components/landing/landing-layout'
import { History } from './components/landing/pages/history/history'
import { Intro } from './components/landing/pages/intro/intro'
@ -12,6 +13,7 @@ import { Profile } from './components/landing/pages/profile/profile'
import './global-style/index.scss'
import * as serviceWorker from './service-worker'
import { store } from './utils/store'
import { Redirector } from './components/redirector/redirector'
ReactDOM.render(
<Provider store={store}>
@ -41,9 +43,15 @@ ReactDOM.render(
<Route path="/n/:id">
<Editor/>
</Route>
<Route path="/:id">
<Redirector/>
</Route>
<Route path="/">
<Redirect to="/intro"/>
</Route>
<Route>
<NotFound/>
</Route>
</Switch>
</ApplicationLoader>
</Router>