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