data provider navigation

getOne: async ({ resource, id, meta }) => { console.log(resource, id); const token = localStorage.getItem(TOKEN_KEY); // const { list } = useNavigation(); const created_by = localStorage.getItem("id") ? localStorage.getItem("id") : 0 try{ const response = await axios.get(${API_URL}/${resource}/show/${id}, { headers: { Authorization: Bearer ${token}, "ngrok-skip-browser-warning": "true", "created_by":created_by }, // params:{ // created_by: localStorage.getItem("id") // } }); console.log("resssss", response); const data = response.data.data; return { data }; } catch(error:any){ const errorMs: HttpError = { message: error?.response?.data?.message error.message "Not Found !", statusCode: error?.status || 500, resource: "", }; return Promise.reject(errorMs); navigation('/') } }, want to navigate to list if the it shows Error msg
2 Replies
kapa.ai
kapa.ai4d ago
Hi @vinoth. 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, you can refer to the Data Provider documentation (https://refine.dev/docs/data/data-provider/) for more information on handling data operations and error handling in refine. Additionally, you might find the useNavigation hook documentation (https://refine.dev/docs/routing/hooks/use-navigation/#return-values) useful for understanding how to navigate programmatically in refine. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4d ago
<@1270329411844968520> Kapa.ai is still learning and improving, please let me know how I did by reacting below.