Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple guardprovider support #37

Closed
LuukEbenau opened this issue Apr 20, 2020 · 1 comment
Closed

multiple guardprovider support #37

LuukEbenau opened this issue Apr 20, 2020 · 1 comment
Labels
question Further information is requested

Comments

@LuukEbenau
Copy link

LuukEbenau commented Apr 20, 2020

Allow multiple guardproviders with different guards

Basic example

I want to redirect not logged in users to the login page, and if logged in people navigate to the login page, redirect them to the homepage.

      <Router history={history}>
        <NavigationBar />
        <Switch>
          <GuardProvider guards={[requireLoggedOut]}> {/* this one works */}
            <GuardedRoute path="/auth" exact component={AuthSwitchPage} />
            <GuardedRoute path="/auth/redirect" exact component={PostAuthRedirectPage} />
            <GuardedRoute path="/auth/register/pincode" component={PincodeRegisterPage} />
          </GuardProvider>
          <GuardProvider guards={[requireLogin]}>{/* this does not work anymore, no errors thrown however. */}
            <GuardedRoute
              path="/form/:formtakementId/:stepId"
              exact
              component={FormTakementStep}
            />
            <GuardedRoute
              path="/form/:formtakementId"
              exact
              component={FormLandingPage}
            />
            <GuardedRoute path="/" exact component={OverviewPage} />
          </GuardProvider>
        </Switch>
      </Router>

Can support for multiple providers be added, and is there a temporary workaround?

@joshpensky
Copy link
Member

joshpensky commented Apr 21, 2020

Hey @LuukEbenau! This looks to be a duplicate issue of #29, you can follow along there for more information about our current support plan for Switch and multiple providers!

@joshpensky joshpensky added the question Further information is requested label Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants