R
Refine

ask-any-question

Multitenant URLs

Ccorrect-apricot3/22/2023
Hi all! Anyone have more info on how to provide props to the nextjs-router in v4? We are multitenant, so URL path will be /:tenantId/post/:id How do I provide a session specific tenantId to the router?
Kkapa.ai3/22/2023
Hey @jekedorff! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
Kkapa.ai3/22/2023
---------------------- In refine v4, you can define custom routes for your resources, which allows you to handle multi-tenant structures with ease. Here's an example of how you can define custom routes with tenantId in the URL path:
resources={[
{
name: "products",
list: "/:tenantId/products",
show: "/:tenantId/products/:id",
edit: "/:tenantId/products/:id/edit",
create: "/:tenantId/products/create",
},
]}
resources={[
{
name: "products",
list: "/:tenantId/products",
show: "/:tenantId/products/:id",
edit: "/:tenantId/products/:id/edit",
create: "/:tenantId/products/create",
},
]}
This is only a resource definition, which must be handled within the preferred router structure. The detail page of a product can have a nested structure and also supports additional parameters. These parameters can be passed along with the meta properties in such hooks and components. Existing parameters in the URL will also be used when constructing the navigation path. For more information, refer to the extract on multi-tenant structures (https://refine.dev/docs/migration-guide/3x-to-4x#resources). ----------------------
Migrating from 3.x.x to 4.x.x | refine
Motivation behind the release
Kkapa.ai3/22/2023
<@904809161366335489> kapa.ai is still learning and improving, please let us how it did by reacting below
Sstormy-gold3/22/2023
Hi @jekedorff , It's depend on your auth provider implementation. I think, you need to pass tenantId and user token to the your API. Then, you can use response in your check method in authProvider. I believe, you can inspire from our nextjs example: https://github.com/refinedev/refine/tree/next/examples/with-nextjs
Ccorrect-apricot3/22/2023
Thanks a lot. I already get the tenantId from my authProvider, it is just how to efficiently use it in routerProvider I do not understand. Can I add it as a general param to the routerProvider or do I have manually include it in my calls to push/replace ?
Sstormy-gold3/22/2023
You don’t need to handle for all situations. For example buttons have “meta” property for this. You can check out here: https://refine.dev/docs/api-reference/antd/components/buttons/show-button/#meta
Show | refine
uses Ant Design's component. It uses the show method from useNavigation under the hood. It can be useful when redirecting the app to the show page with the record id route of resource.
Ccorrect-apricot3/22/2023
Thanks a lot! The meta property in the various useNavigation functions was exactly what I was looking for. 👌

Looking for more? Join the community!

R
Refine

ask-any-question

Join Server
Recommended Posts
Using response data in errorNotification useFormHello, My REST API sends a JSON with explanation of what's wrong with the response when request failImplement Google Maps in a FormHello everyone, I am having trouble implementing google maps in a form where the user should fill soCannot invoke an object which is possibly 'undefined'Hi everyone, can anyone help me with this? I trying to integrate Access Control with Supabase and whhow to prefetch data using refineprefetch data before showing itemCan't change title of AuthPageI tried to change my login page title like this: <AuthPage type="login" title={<h2>WelcoUse modal form to populate an array in the current recordHello all, I need some help here. I'm trying to implement modal form in a project I'm working on witDefine customized Logo on default LoginpageHi, how can i set a logo on default Loginpage. (I am using refine V4)Error Can't resolve 'fs'Hello everyone, I'm facing an error integrating Casbin accessControlProvider here is the code for v4: Supabase: updatePassword not working```javascript forgotPassword: async ({ email }) => { const { error } = await supabaseClient.authCan I still use v3?Hello, I'm trying to follow a tutorial from Javascript Mastery and I think he used the v3 of refineAuthPage does not handle any errorsDoes the default AuthPage do any error handling by default ? I return an error in my authProvider `How to dynamically change page titles and adapt login background design? (in v4)Hello everyone, I cant find anything about that for the newest version online. Did anybody figure tinferencer: Custom key for `object` type propertyHow to set custom key that will represent an `object` type property? if it is not possible, is it a Change Logo in default SidebarHey where can I change the Sidebar Logo in refine? I cant find it ...How to add a custom breadcrumb items?I have a nested routes and in that nested routes list page the breadcrumb is not show. How to add a Data provider requests in loop when using ViteI am trying to migrate my Refine with Remix app to Vite. This app is still at the very beginning, it