Login-component
Hello team I am trying to setup a login component for a new project i am trying out in refine. Is there any detailed step by step guide. I was able to download example from github which works fine, but when i setup a new component it gives error,which as i understand shows like the data is not getting returned
27 Replies
Hey @venkatasrikanths 👋,
Welcome, we are glad to see you! Could you share more details? Error, code, etc. 🚀
fair-rose•2y ago
Following is the error message i am getting - Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ["getUserIdentity"]
i copied the login page from task master example in my app
Hmm could you share your getUserIdentity function of authProvider?
fair-rose•2y ago
const mockUsers = [{ username: "admin" }, { username: "editor" }];
const authProvider = {
login: ({ username, password, remember }:{username:string, password:string, remember:boolean}) =>
{
// Suppose we actually send a request to the back end here.
const user = mockUsers.find((item) => item.username === username);
if (user) {
localStorage.setItem("auth", JSON.stringify(user));
return Promise.resolve("/posts");
}
return Promise.reject();
},
register: () => Promise.resolve(),
forgotPassword: () => Promise.resolve(),
updatePassword: () => Promise.resolve(),
logout: () => Promise.resolve(),
checkAuth: () => Promise.resolve(),
checkError: () => Promise.resolve(),
getPermissions: () => Promise.resolve(),
getUserIdentity: () => Promise.resolve({
name: "admin"
})
};
export default authProvider;
No issue appears here. Which example did you copy?
fair-rose•2y ago
i did basic ant-d tutorial https://refine.dev/docs/tutorials/ant-design-tutorial/ and tried to add login component from https://refine.dev/blog/customizable-issue-tracker-with-refine-and-supabase/
Your First App using Ant Design | refine
Introduction
Create Your Easy Customizable Internal Issue Tracker With Refine an...
This web application will us to create issue and tasks for your team members. You will also be able to choose the priority of these tasks, their tags, and which person to assign them to.
Could you try this example?
https://github.com/pankod/refine/tree/next/examples/authentication/antd
GitHub
refine/examples/authentication/antd at next · pankod/refine
Build your React-based CRUD applications, without constraints. - refine/examples/authentication/antd at next · pankod/refine
fair-rose•2y ago
Sure will give a try and update you
Thank you for your patiance. We will investigate the example you forwarded tomorrow.
fair-rose•2y ago
Any easy way to share code with you
I'm sure this example will work 🙂
fair-rose•2y ago
thanks
Did it work? 👀
fair-rose•2y ago
i am trying to running in stackblitz and somehow the UI is not loading up
Will try and let you know
I tried the example give by you as well. it doesnt seem to work for me
fair-rose•2y ago