Skip to content

Use goto (or switchTo) inside the routing match #2

@ajcamilo

Description

@ajcamilo

How can I use the goto inside the current definition?

I have the following route:

private lazy val current: Rx[Frag] = Rx {
  if(authorized()){
    router.current() match {
      case HomeScreen => HomePage()
      case AboutScreen => AboutPage()
      case _ => router.goto(HomeScreen)
    }
  } else {
     router.current() match {
       case LoginScreen => LoginPage()
       case _ => router.goto(LoginScreen)
    }
  }
}

This doesn't work, current appears to be empty after the goto.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions