Is it definitely reaching whatever function handles the login? Could you dd() there and push out everything from Request ?
Angular4+ Frontend POST Request to Laravel API
Hey guys!
I'm having troubles solving my problem.
First of all, I'm using (as the title implies) Angular for my Frontend and Laravel for my Backend.
Communication to my API works like a charm BUT I'm not able to retrieve send parameter.
Here's my code:
login(username: string, password: string) {
return this.http.post(
'http://localhost:8000/api/login',
JSON.stringify({ username: username, password: password }))
.map((response: Response) => {
let user = response.json();
if (user && user.token) {
localStorage.setItem('currentUser', JSON.stringify(user));
}
return user;
});
}
When I have a look inside my POST Request, I can see passed Parameter (JSON): { username: testUser, password: testPassword }
I'm trying to log these parameters using $request->all(), etc. but every variable I'm normally using retrieving data from a send form is empty. :/
Yes, the data get send but in my backend I'm not able to retrieve those. Google and Stackoverflow couldn't help me...
Thanks for your help!
Greetz, Paddaels
Please or to participate in this conversation.