R
Refine

ask-any-question

why can't use underline as name?

Aadverse-sapphire3/12/2024
why can't use underline as name? { name: 'temp_products', list: 'temp-products', create: '/temp-products/create', edit: '/temp-products/edit/:id', show: '/temp-products/show/:id',
Kkapa.ai3/12/2024
Hi @yasuaki_jp. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the extracts, there's no explicit restriction mentioned about using an underline in the name property of a resource in Refine. The name property is a string value that identifies a resource in the API. It's used to interact with the data in a resource using an endpoint determined by the name. Here's an example from the Refine documentation (https://refine.dev/docs/core/refine-component#resources):
resources={[
{
name: "posts",
list: "/posts",
create: "/posts/create",
edit: "/posts/edit/:id",
show: "/posts/show/:id",
},
]}
resources={[
{
name: "posts",
list: "/posts",
create: "/posts/create",
edit: "/posts/edit/:id",
show: "/posts/show/:id",
},
]}
In your case, using temp_products as the name should work as expected, as long as there's a corresponding endpoint in your API. However, it's important to ensure that the name matches the endpoint in your API. For example, if your API endpoint is <https://api.example.com/temp-products,> then you should use temp-products as the name. If you're experiencing issues, it might be due to other factors not related to the use of an underline in the name. It's recommended to check your API endpoint and ensure that it matches the name you're using in your resource definition. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Aadverse-sapphire3/12/2024
@kapa.ai sider render as temp_products but I wrote /temp-products
Kkapa.ai3/12/2024
Let me check the knowledge base for you. One moment! :books: ---------------------- The name property you provide in the resources array is used by Refine to create routes and also to display in the sidebar. If you provide temp_products as the name, it will be displayed as such in the sidebar. If you want to display a different name in the sidebar, you can use the options property with a label field in your resource definition. The label field allows you to specify a custom label for the resource that will be displayed in the sidebar. Here's how you can do it:
resources={[
{
name: "temp_products",
list: "/temp-products",
create: "/temp-products/create",
edit: "/temp-products/edit/:id",
show: "/temp-products/show/:id",
options: {
label: "Temp Products"
}
},
]}
resources={[
{
name: "temp_products",
list: "/temp-products",
create: "/temp-products/create",
edit: "/temp-products/edit/:id",
show: "/temp-products/show/:id",
options: {
label: "Temp Products"
}
},
]}
In this example, "Temp Products" will be displayed in the sidebar instead of "temp_products". Please note that the label field does not affect the API endpoint. The name field is still used to interact with the API endpoint. For more information, you can refer to the Refine documentation (https://refine.dev/docs/core/refine-component#resources). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Kkapa.ai3/12/2024
<@449197041306828802> kapa.ai is still learning and improving, please let us know how it did by reacting below
Aadverse-sapphire3/12/2024
sider link to temp_products but acctually temp-products @kapa.ai sider link to temp_products but acctually temp-products
Kkapa.ai3/12/2024
Let me check the knowledge base for you. One moment! :books: ---------------------- The name property in the resources array is used by Refine to create routes and also to display in the sidebar. If you provide temp_products as the name, it will be displayed as such in the sidebar and the route will be /temp_products. If you want the route to be /temp-products but display as temp_products in the sidebar, you can use the meta property with a label field in your resource definition. The label field allows you to specify a custom label for the resource that will be displayed in the sidebar. Here's how you can do it:
resources={[
{
name: "temp-products",
list: "/temp-products",
create: "/temp-products/create",
edit: "/temp-products/edit/:id",
show: "/temp-products/show/:id",
meta: {
label: "Temp Products"
}
},
]}
resources={[
{
name: "temp-products",
list: "/temp-products",
create: "/temp-products/create",
edit: "/temp-products/edit/:id",
show: "/temp-products/show/:id",
meta: {
label: "Temp Products"
}
},
]}
In this example, "Temp Products" will be displayed in the sidebar and the route will be /temp-products. Please note that the label field does not affect the API endpoint. The name field is still used to interact with the API endpoint. For more information, you can refer to the Refine documentation (https://refine.dev/docs/guides-concepts/faq#how-can-i-add-an-item-to-the-sider-component). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Kkapa.ai3/12/2024
<@449197041306828802> kapa.ai is still learning and improving, please let us know how it did by reacting below
Aadverse-sapphire3/12/2024
@kapa.ai but acctually table name is temp_products
Kkapa.ai3/12/2024
Let me check the knowledge base for you. One moment! :books: ---------------------- If your table name in the database is temp_products but you want the route in your Refine application to be temp-products, you need to handle this mapping in your API layer. Refine uses the name property in the resources array to interact with the API and to create routes. If you provide temp-products as the name, Refine will make requests to the temp-products endpoint and also create routes like /temp-products, /temp-products/create, /temp-products/edit/:id, etc. In your API layer, you need to map the temp-products endpoint to the temp_products table in your database. This way, when Refine makes a request to the temp-products endpoint, your API will interact with the temp_products table. Here's an example of how you can define your resource in Refine:
resources={{[
{{
name: "temp-products",
list: "/temp-products",
create: "/temp-products/create",
edit: "/temp-products/edit/:id",
show: "/temp-products/show/:id",
}},
]}}
resources={{[
{{
name: "temp-products",
list: "/temp-products",
create: "/temp-products/create",
edit: "/temp-products/edit/:id",
show: "/temp-products/show/:id",
}},
]}}
In this example, Refine will make requests to the temp-products endpoint and your API needs to handle these requests and interact with the temp_products table in your database. For more information, you can refer to the Refine documentation (https://refine.dev/docs/core/refine-component#resources). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Kkapa.ai3/12/2024
<@449197041306828802> kapa.ai is still learning and improving, please let us know how it did by reacting below

Looking for more? Join the community!

R
Refine

ask-any-question

Join Server
Recommended Posts
How to use _ as name but use path - instead of _How to use _ as name but use path - instead of _How do I send with admin ID?``` import { AuthBindings } from '@refinedev/core' import nookies from 'nookies' const mockUsers = sidemenu elements namehow can I put a name differente than the resource name in the menu elementsuseList disableIs it possible to disable useList based on prop valueuseUpdateHow to update a resource using on button clickHow to current page to 1 on apply filtersHere is my getList code getList: async ({ resource, pagination, filters, meta }) => { consRefresh the page when closing the modal``` export const PointsModal = ({ type, point_id, member_id }: PointsModalProps) => { const { Button click not workingHello All, I have a form that suddenly doesn' t work I have been upgrading the project to 4 and am pAccessing data using useoneThis is my .tsx file import { Typography, Spin, Alert } from "antd"; import { useOne } from "@refineresolversis there a resolver sample for refine app crm?NavegationHow to put the sider menu on the top navegation using ant designgrapql refine crm appdo i still need to create typedefs and resolvers on my backend?Refine app crmIs there any database schema for the refine app crm? for the typeDefs and resolvers?useExport not downloading, no errorThis is my current code When i press the export button the query sent to the graphql and receive a vSupabase Authentication Trigger & Refine App Integration QuestionHi everyone, I hope you're all doing well. I am encountering a challenge with Supabase AuthenticatiReset number on every new yearHow to reset a number every new year?pageSizeHow to disable pageSizeHey, Im new to web development, imHey, Im new to web development, im trying to connect refine app crm with mongo db? Is it possible?How do I pass variable in useTableconst { tableProps } = useTable({ resource: "sensorData", meta: { gqlQuery: GET_SENSORHi all, I’m hoping someone can help meHi all, I’m hoping someone can help me wrap my head around issues with API keys and environment vari