continuing-cyan
continuing-cyan2mo ago

Getting double slash and getting 301 moved permanently when manually changing url

So basicallly i am getting double slash when i try to use getOne like this https://api.cibuilders.co.in/admin-pannel/project//2229 and the url of the page is http://localhost:5173/admin-pannel/project/edit/2229 now when I try to manually change the getOne url from dataProvider like this getOne: async ({ resource, id, meta }) => { const url = ${apiUrl}/${resource}${id}`;..} then i am getting the correct url but getting this error that is 301 moved permanently and when i try to test the same url in postman its working perfectly fine
No description
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @rapper_015. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, based on the information you provided, it seems like there might be an issue with how you're constructing your URL in the getOne function. In the getOne function you provided, it seems like you're missing a slash (/) between ${resource} and ${id}. This might be causing the double slash issue you're experiencing. The URL should be constructed like this: ${apiUrl}/${resource}/${id}. As for the 301 Moved Permanently error, this typically means that the URL you're trying to access has been permanently moved to a new location. The server should provide the new location in the response. Without more information, it's hard to provide a more specific solution. I would recommend checking your server configuration and making sure that the URL you're trying to access is correct. For more information on how to use the getOne function in Refine, you can check out the Refine documentation (https://refine.dev/docs/api-references/hooks/crud-hooks#usegetone). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@498390360180129804> kapa.ai is still learning and improving, please let us know how it did by reacting below