3

2 months agoby Praveen Kumar

Practice of Pingpong Authentication.

Dear Sir,

I am new in React Js and try to learn react js by your tutorial and facing issue. when setup Pingpong Authentication code on our machine localhost and submit the login form then getting an error. Error is:-

Unhandled Rejection (TypeError): Cannot read property 'data' of undefined (anonymous function) E:/xampp/htdocs/pingpong/src/Login.js:22 19 | cookie.set("user", res.data.user); 20 | this.props.history.push("/profile"); 21 | }) > 22 | .catch(e => this.setState({ errors: e.response.data})); | ^ 23 | }; 24 | 25 | handleInput = (e)=>{ View compiled This screen is visible only in development. It will not appear if the app crashes in production. Open your browser’s developer console to further inspect this error.

10

Bitfumes replied 2 months ago

1

Yes, this error comes only when token is invalid or expired and you refresh the page, I will handle this error in later episodes of this video

72

Sarthak Shrivastava replied 2 months ago

0

You have not started laravel server, please check you have localhost:8000 working fine

3

Praveen Kumar replied 2 months ago

0

Thanks for your reply Sarthak sir. But I am also PHP, Laravel developer. it is a basic thing that laravel localhost server is start or not. In my case localhost:8000 is running and when register an user by register form then data is store in my pingpong DB on localhost DB server but on web browser screen gives error page which is post on my problem. and i got same error when submit the login form. Please suggest me what is i doing wrong.

3

Praveen Kumar replied 2 months ago

0

Dear Sarthak Sir,

I have also getting new errors on this pingpong series, when submit the login form Error is:

Access to XMLHttpRequest at 'http://localhost:8000/api/auth/login' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

please help me asap.

Thanks.

Ask Question
Most Visited
Categories