like-gold
like-gold2y ago

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
Omer
Omer2y ago
Hey @venkatasrikanths 👋, Welcome, we are glad to see you! Could you share more details? Error, code, etc. 🚀
optimistic-gold
optimistic-gold2y 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
Omer
Omer2y ago
Hmm could you share your getUserIdentity function of authProvider?
optimistic-gold
optimistic-gold2y 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;
Omer
Omer2y ago
No issue appears here. Which example did you copy?
optimistic-gold
optimistic-gold2y ago
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.
Omer
Omer2y ago
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
optimistic-gold
optimistic-gold2y ago
Sure will give a try and update you
Omer
Omer2y ago
Thank you for your patiance. We will investigate the example you forwarded tomorrow.
optimistic-gold
optimistic-gold2y ago
Any easy way to share code with you
Omer
Omer2y ago
I'm sure this example will work 🙂
optimistic-gold
optimistic-gold2y ago
thanks
Omer
Omer2y ago
Did it work? 👀
optimistic-gold
optimistic-gold2y 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
optimistic-gold
optimistic-gold2y ago
Omer
Omer2y ago
You should use node as a preset in StackBlitz. example, https://stackblitz.com//github/pankod/refine/tree/master/examples/authorization?preset=node
optimistic-gold
optimistic-gold2y 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
optimistic-gold
optimistic-gold2y ago
attached is error file
optimistic-gold
optimistic-gold2y 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
Omer
Omer2y ago
What is your node and npm versions?
optimistic-gold
optimistic-gold2y ago
PS C:\Data\Projects_Srikanth\Reactprojects\refinelogin> npm -v 6.14.12 C:\Users\SrikanthVenkata>node -v v14.16.1
Omer
Omer2y ago
You must use minimum node@16 and npm@8 for refine projects
optimistic-gold
optimistic-gold2y 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
Omer
Omer2y ago
hooraay parrot
optimistic-gold
optimistic-gold2y 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
Omer
Omer2y ago
Hey @venkatasrikanths 👋 , Thank you for contacting us! Could you create a form post on the #ask-any-question forum?
optimistic-gold
optimistic-gold2y ago
sure