How to force page loading based on some condition? #155
-
The main idea is to have two different page: login page and restricted page. The start page is login page. When a user is successfully authorised, I want to load restricted page. Debug shows that Brief overview on my solution.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Why do you need Are you perhaps looking for BTW, unrelatedly, val owner = new ManualOwner()
rest.callLoginApi(state.now().login, state.now().password)
.foreach {
case ApiResponse.Result(_) =>
owner.killSubscriptions()
...
case _ =>
owner.killSubscriptions()
}(owner) that way when you get the response, you clean up the subscription. Note – normally manually managing owners like this isn't needed in Laminar – most of your subscriptions use |
Beta Was this translation helpful? Give feedback.
Why do you need
forcePage
? That method's purpose does not seem to match your use case.Are you perhaps looking for
router.pushState(RestrictedPageView.page)
?BTW, unrelatedly,
OneTimeOwner(() => {})
is a memory leak. on every request you're creating an owner and a subscription that you never clean up. For network requests you can do something like:that way when you get the response, you clean up the subscription.