AnthonMS / TimeMentor

This is the temporary repo for my Final Assignment for my studies
0 stars 0 forks source link

Create Sign in page incl. php service #3

Closed AnthonMS closed 6 years ago

AnthonMS commented 6 years ago

Time Estimate: 8 Hours Create the Sign in component in Angular, and design the front end so it is pretty and minimalistic. Then create the php service that is gonna be called to handle the login credentials. It is gonna recieve it as an object. Then check the database for the credentials and confirm login information. Then return back success or error. Then create the Angular Service that is gonna call this php script. We do that by going to the console again and use this command:

ng generate service data data = service name

This is gonna create the service in the root folder. You can then use this service by importing like this:

import { DataService } from '../data.service';

Then you create the service function: This is gonna call the php service that checks the database. And it is going to POST the user data with it as payload.

login(user) { return this.http.post( this.API_URL + "login.php?function=login", user, { responseType: 'text' }); }

Then you can call it on click by creating a function in the signin component. That calls the login data service:

this.data.login(user).subscribe((response) => { if (response == "SUCCESS") { } else { } }); }

AnthonMS commented 6 years ago

Created the sign in component and designed the frontend. I then wrote the services needed to log in. I then put it all together and created the login feature.