-
Notifications
You must be signed in to change notification settings - Fork 164
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
Redirect not available #201
Comments
Redirect is a server-side API: public class SettingsViewModel : BaseVM, IRoutable
{
public Route AboutView => this.Redirect("about");
...
} Client-side: onclick={() => this.vm.$routeTo(this.state.AboutView)} |
Hi @dsuryd thanks for pointing me in the correct direction. Redirect has two parameters I tried a few different combinations like: I register the Routes in the ApplayoutViewModel like:
The urls look like this:
|
Try initialize the RoutingState: |
@dsuryd with ("/", "AboutView") and RoutingState initialized I don't get any log output but the page gets changed neither =( |
Turn on client debugging (dotnetify.debug = true); there will be log outputs as it tries to resolve the route. Also, you can reference dotnetify react template for redirect example. The dashboard activities card has redirect link to the form page. |
I enabled debug in the constructor of the SettingsView
There is no additional log visible when I click for route to just nothing happens! I checked out the redirect of the form page and the only difference I saw was the register routes. If I also set the path I am able to get it to work. However like this a have an id in the url. |
I think I found the problem. Given your setup, the redirect logic erroneously produces a path with two leading slashes. I have a workaround hack until a proper fix is released. Add the below code after the const base = this.vm.$route;
this.vm.$route = route => base(route).replace(/^\/\//, '/'); |
I use an AppLayout view which consists of the Header Sidebar and the content.
All my routes (eg settings and about) are declared in the AppLayoutViewModel.
I am trying to change the page from the settings page to the about view.
As mentioned in the documentation https://dotnetify.net/core/api/routing I should use redirect for this. However on the router I do not have a redirect.
Am I missing something?
The text was updated successfully, but these errors were encountered: