Skip to content

Group routes #40

@muarachmann

Description

@muarachmann

Hi +1 for this package,
While exposing the routes is a good thing, Is there a way one can group the routes exposed and show only some on some certain scenarios?

Imagine when you are not authenticated, and have a dashboard route, I won't want to expose this. How about we have
@ellmetha let me know your thoughts on this, or rather if this package handles it in another way. Else I can send a PR for this.

JS_ROUTES_INCLUSION_LIST = [
    {
        'guest': ['home', 'about', 'privacy_policy' .... ]
    }, 
    {
        'auth': ['home', 'about', 'privacy_policy', 'dashboard.index', 'dashboard.posts' .... ]
    }, 
]

With this, a logic can be put on our front-ends as -

{% if user.is_authenticated %}
   {% js_routes group='auth' %}
{% else %}
   {% js_routes group='guest' %}
{% endif %}

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