components#RouteGuard TypeScript Examples

The following examples show how to use components#RouteGuard. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: App.tsx    From crossfeed with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
App: React.FC = () => (
  <MatomoProvider value={instance}>
    <Router>
      <CFThemeProvider>
        <AuthContextProvider>
          <SearchProvider>
            <Layout>
              <LinkTracker />
              <Switch>
                <RouteGuard
                  exact
                  path="/"
                  render={() => <Redirect to="/inventory" />}
                  unauth={AuthLogin}
                  component={Risk}
                />
                <RouteGuard
                  exact
                  path="/signup"
                  render={() => <Redirect to="/inventory" />}
                  unauth={(props) => <AuthLogin {...props} showSignUp={true} />}
                  component={Risk}
                />
                <Route
                  exact
                  path="/login-gov-callback"
                  component={LoginGovCallback}
                />
                <Route
                  exact
                  path="/create-account"
                  component={AuthCreateAccount}
                />
                <Route exact path="/terms" component={TermsOfUse} />

                <RouteGuard exact path="/inventory" component={SearchPage} />
                <RouteGuard
                  path="/inventory/domain/:domainId"
                  component={Domain}
                />
                <RouteGuard path="/inventory/domains" component={Domains} />
                <RouteGuard
                  path="/inventory/vulnerabilities"
                  exact
                  component={Vulnerabilities}
                />
                <RouteGuard
                  path="/inventory/vulnerabilities/grouped"
                  component={(props) => (
                    <Vulnerabilities {...props} groupBy="title" />
                  )}
                />
                <RouteGuard
                  path="/inventory/vulnerability/:vulnerabilityId"
                  component={Vulnerability}
                />

                <RouteGuard path="/feeds" component={Feeds} />
                <RouteGuard path="/scans" component={Scans} exact />
                <RouteGuard path="/scans/history" component={Scans} exact />
                <RouteGuard path="/scans/:scanId" component={Scan} />
                <RouteGuard
                  path="/organizations/:organizationId"
                  component={Organization}
                />
                <RouteGuard path="/organizations" component={Organizations} />
                <RouteGuard path="/users" component={Users} />
                <RouteGuard path="/settings" component={Settings} />
              </Switch>
            </Layout>
          </SearchProvider>
        </AuthContextProvider>
      </CFThemeProvider>
    </Router>
  </MatomoProvider>
)