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. 🚀
rising-crimson•3y 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?
rising-crimson•3y 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?
rising-crimson•3y 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
rising-crimson•3y ago
Sure will give a try and update you
Thank you for your patiance. We will investigate the example you forwarded tomorrow.
rising-crimson•3y ago
Any easy way to share code with you
I'm sure this example will work 🙂
rising-crimson•3y ago
thanks
Did it work? 👀
rising-crimson•3y 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
rising-crimson•3y ago
You should use
node
as a preset in StackBlitz. example,
https://stackblitz.com//github/pankod/refine/tree/master/examples/authorization?preset=node
rising-crimson•3y ago
Im not that good with stackblitz.. not sure what is this setting let me check and try again
i copied the example you provided to local and ran npm install got following alerts
rising-crimson•3y ago
attached is error file
rising-crimson•3y ago
now i am getting login page. but i need to check why the same is not happening when i build the code from scratch
thanks for helping out
What is your node and npm versions?
rising-crimson•3y ago
PS C:\Data\Projects_Srikanth\Reactprojects\refinelogin> npm -v
6.14.12
C:\Users\SrikanthVenkata>node -v
v14.16.1
You must use minimum node@16 and npm@8 for refine projects
rising-crimson•3y ago
oh okay thanks
let me upgrade and try again
Thanks for the help after upgrading npm and node things are working fine so far
hooraay
rising-crimson•3y ago
Hi Omer
I am planning to build a task manager for our company
i started following example give in blog > However the login page does not come up
is it possible to help me on the same
https://github.com/svsrikanth2001/srikanth-task-manager
I tried to run in stackblitz but it take forever to load dependencies
Hey @venkatasrikanths 👋 ,
Thank you for contacting us! Could you create a form post on the #ask-any-question forum?
rising-crimson•3y ago
sure