Skip to content

Inertia multi rootView config #4580

Answered by Julien-R44
kitro asked this question in Help
May 20, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hey, we don't have anything for that today. Having to add middleware for that seems a bit cumbersome to me

What about allowing a function for rootView in the config/inertia.ts file instead?

import { defineConfig } from '@adonisjs/inertia';

export default defineConfig({
  rootView: ({ request }: HttpContext) => {
    if (request.url().startsWith('/admin')) {
      return 'admin_layout';
    }

    return 'inertia_layout';
  },
})

Happy to accept a PR for that

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kitro
Comment options

@Julien-R44
Comment options

Answer selected by kitro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants