Fix: Cannot read properties of undefined (reading 'status')
Solution: to fix this error, the route in my front end was different then in my api.php file.
Problem:
FrontEnd axios:
Backend: api.php
Do you see the difference? the difference is `/logs_user_tasks/` and '/logs_user_tasks'
Incase you can't see it, its the extra backslash at the end
In the console, i kept getting this error:
Access to XMLHttpRequest at 'https://example.domain.com/api/logs_user_tasks/' from origin 'https://127.0.0.1' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
UPDATE: 8/8/2024 - During the developement of the Todo app, i kept getting CORS errors was able to solve the problem by changing the endpoin in the React file wereh it was calling API from the axios>
SOLUTION: Remove the extra slash at the end of the endpoint. I was using a apiResource route: Route::apiResource('/todo', TodoController::class);
CHANGE FROM:
CHANGED TO:
ERROR:
Blocked loading mixed active content “http://dailylog.example.com/api/todo”
todo
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dailylog.example.com/api/todo/. (Reason: CORS request did not succeed). Status code: (null).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dailylog.example.com/api/todo/. (Reason: CORS request did not succeed). Status code: (null).
Blocked loading mixed active content “http://dailylog.example.com/api/todo”
todo
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dailylog.example.com/api/todo/. (Reason: CORS request did not succeed). Status code: (null).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dailylog.weexamplebsor.com/api/todo/. (Reason: CORS request did not succeed). Status code: (null).