import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { catchError, retry } from 'rxjs/operators';
import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common';
@Injectable({
providedIn: 'root'
})
export class ApiService {
location: Location;
apiURL='http://207.38.84.105/CT/api';
constructor(private http: HttpClient,location: Location){
this.location = location;
}
Login(data){
return this.http.post(this.apiURL + '/loginCT.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
queryCandidateget(data){
return this.http.post(this.apiURL + '/queryCandidateget.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
searchInsert(data){
return this.http.post(this.apiURL + '/insertCandidateSearches.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
InsertEmployee(data){
return this.http.post(this.apiURL + '/insertEmployee.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
InsertOffers(data){
return this.http.post(this.apiURL + '/insertCandidateoffer.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
InsertBlackList(data){
return this.http.post(this.apiURL + '/insertCandidateBlacklist.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
GetEmployees(data){
return this.http.post(this.apiURL + '/getEmoloyeesbyCompanyId.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
GetBlackList(data){
return this.http.post(this.apiURL + '/getBlacklistbyCompanyId.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
GetOffers(data){
return this.http.post(this.apiURL + '/getOffersbyCompanyId.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
Deleteblacklist(data){
return this.http.post(this.apiURL + '/deleteBlacklistbyId.php',data)
.pipe(
retry(1),
catchError(this.handleError)
)
}
// Error handling
handleError(error) {
let errorMessage = '';
if(error.error instanceof ErrorEvent) {
// Get client-side error
errorMessage = error.error.message;
} else {
// Get server-side error
errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;
}
window.alert(errorMessage);
return throwError(errorMessage);
}
}
<form [formGroup]="firstFormGroup" style="width: 80%;">
<input formControlName="LastName" >
</form>
this.firstFormGroup = this._formBuilder.group({
FirstName: ['', Validators.required],
LastName: ['', Validators.required],
PAN:[''],
Aadhaar: [''],
Mobile: ['', Validators.required],
Email:['', Validators.required],
BlackListedOn: ['', Validators.required],
Reason: ['', Validators.required],
CandidateResponse:[''],
Attach1:[''],
Attach2:[''],
Attach3:['']
}); }
const routes: Routes = [
{ path: 'login', component: LoginComponent },
{ path: 'admin', loadChildren: () => import('./pages/postLogin/admin/admin.module').then(m => m.AdminModule) },
]
Comments
Post a Comment