login issue fix
This commit is contained in:
parent
ac1402df52
commit
40fb087f98
@ -18,12 +18,17 @@ export class TokenInterceptor implements HttpInterceptor {
|
|||||||
|
|
||||||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
// const tokenUrl = 'http://example.com/token'; // replace with your token url
|
// const tokenUrl = 'http://example.com/token'; // replace with your token url
|
||||||
const token = localStorage.getItem('user_token'); // get the token from local storage
|
const token = localStorage.getItem('user_token');
|
||||||
const authReq = req.clone({
|
let authReq:any; // get the token from local storage
|
||||||
headers: req.headers.set('x-access-token', token).set('Content-Type', 'application/json')
|
if(token != '' && token != undefined && token != null){
|
||||||
});
|
authReq = req.clone({
|
||||||
|
headers: req.headers.set('x-access-token', token).set('Content-Type', 'application/json')
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
authReq = req;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return next.handle(authReq);
|
return next.handle(authReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,8 @@ import { ProgressSpineerDialogComponent } from './shared/progress-spineer-dialog
|
|||||||
import { AppoinmentModule } from './appoinment/appoinment.module';
|
import { AppoinmentModule } from './appoinment/appoinment.module';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { TokenInterceptor } from './_guard/token.interceptor';
|
import { TokenInterceptor } from './_guard/token.interceptor';
|
||||||
|
import { SessionService } from './session-services/session.service';
|
||||||
|
import { AppointmentService } from './appoinment/appointment.service';
|
||||||
|
|
||||||
|
|
||||||
export function HttpLoaderFactory(http: HttpClient) {
|
export function HttpLoaderFactory(http: HttpClient) {
|
||||||
@ -87,6 +89,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
TranslateService,
|
TranslateService,
|
||||||
|
SessionService,
|
||||||
|
AppointmentService,
|
||||||
{
|
{
|
||||||
provide: PERFECT_SCROLLBAR_CONFIG,
|
provide: PERFECT_SCROLLBAR_CONFIG,
|
||||||
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
|
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
|
||||||
|
|||||||
@ -27,6 +27,9 @@ import { ConsultantsModule } from './consultants/consultants.module';
|
|||||||
ServiceListModule,
|
ServiceListModule,
|
||||||
ConsultantsModule
|
ConsultantsModule
|
||||||
],
|
],
|
||||||
|
providers:[
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
})
|
})
|
||||||
export class AppoinmentModule { }
|
export class AppoinmentModule { }
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
<mat-expansion-panel>
|
<mat-expansion-panel>
|
||||||
<mat-expansion-panel-header >
|
<mat-expansion-panel-header >
|
||||||
<div class="example-container mat-elevation-z8 ">
|
<div class="example-container mat-elevation-z8 ">
|
||||||
<table mat-table [dataSource]="dataSource" #mytable class="my-table mat-elevation-z8 len-table">
|
<table mat-table [dataSource]="businessList" #mytable class="my-table mat-elevation-z8 len-table">
|
||||||
|
|
||||||
<ng-container matColumnDef="id">
|
<ng-container matColumnDef="id">
|
||||||
<th mat-header-cell *matHeaderCellDef class="font-color"> S.NO </th>
|
<th mat-header-cell *matHeaderCellDef class="font-color"> S.NO </th>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<ng-container matColumnDef="name">
|
<ng-container matColumnDef="name">
|
||||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Name </th>
|
<th mat-header-cell *matHeaderCellDef class="font-color"> Name </th>
|
||||||
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.name}} </td>
|
<td mat-cell *matCellDef="let element" class="element-spc"> {{element.busName}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="email">
|
<ng-container matColumnDef="email">
|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<ng-container matColumnDef="phone">
|
<ng-container matColumnDef="phone">
|
||||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Phone </th>
|
<th mat-header-cell *matHeaderCellDef class="font-color"> Phone </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.phone}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.contactNo}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="address">
|
<ng-container matColumnDef="address">
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<td mat-cell *matCellDef="let element"> {{element.address}} <br> {{element.city}} <br> {{element.state}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.address}} <br> {{element.city}} <br> {{element.state}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="state">
|
<!-- <ng-container matColumnDef="state">
|
||||||
<th mat-header-cell *matHeaderCellDef class="font-color"> State </th>
|
<th mat-header-cell *matHeaderCellDef class="font-color"> State </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.state}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.state}} </td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<ng-container matColumnDef="city">
|
<ng-container matColumnDef="city">
|
||||||
<th mat-header-cell *matHeaderCellDef class="font-color"> City </th>
|
<th mat-header-cell *matHeaderCellDef class="font-color"> City </th>
|
||||||
<td mat-cell *matCellDef="let element"> {{element.city}} </td>
|
<td mat-cell *matCellDef="let element"> {{element.city}} </td>
|
||||||
</ng-container>
|
</ng-container> -->
|
||||||
|
|
||||||
<ng-container matColumnDef="action">
|
<ng-container matColumnDef="action">
|
||||||
<th mat-header-cell *matHeaderCellDef class="font-color"> Action </th>
|
<th mat-header-cell *matHeaderCellDef class="font-color"> Action </th>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { MatPaginator } from '@angular/material/paginator';
|
|||||||
import { MatSort } from '@angular/material/sort';
|
import { MatSort } from '@angular/material/sort';
|
||||||
import { MatTable, MatTableDataSource } from '@angular/material/table';
|
import { MatTable, MatTableDataSource } from '@angular/material/table';
|
||||||
import Swal from 'sweetalert2/dist/sweetalert2.js';
|
import Swal from 'sweetalert2/dist/sweetalert2.js';
|
||||||
|
import { BusinessService } from '../business-service/business.service';
|
||||||
import { DialogBoxComponent } from '../dialog-box/dialog-box.component';
|
import { DialogBoxComponent } from '../dialog-box/dialog-box.component';
|
||||||
|
|
||||||
export interface UsersData {
|
export interface UsersData {
|
||||||
@ -41,18 +42,44 @@ export class BusinessListComponent implements OnInit {
|
|||||||
// dataSource: any = new MatTableDataSource(ELEMENT_DATA);
|
// dataSource: any = new MatTableDataSource(ELEMENT_DATA);
|
||||||
@ViewChild(MatTable,{static:true}) table: MatTable<any>;
|
@ViewChild(MatTable,{static:true}) table: MatTable<any>;
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
businessList: any;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(public dialog: MatDialog,public _bus:BusinessService) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.dataSource = new MatTableDataSource(ELEMENT_DATA)
|
||||||
|
this.getBusinessList()
|
||||||
|
}
|
||||||
|
|
||||||
|
getBusinessList() {
|
||||||
|
//this._pd.getTabStatusPdDetails(this.tabStatus)
|
||||||
|
this._bus.getBusinessListDetails().subscribe(res => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
this.businessList = res.data;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// , error => {this.errorMessage = <any> error});
|
||||||
|
,error => {
|
||||||
|
// this.errorMessage.push(error);
|
||||||
|
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
|
// alert(error.html_format);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.dataSource.paginator = this.paginator;
|
this.businessList.paginator = this.paginator;
|
||||||
}
|
}
|
||||||
applyFilter(event: Event) {
|
applyFilter(event: Event) {
|
||||||
const filterValue = (event.target as HTMLInputElement).value;
|
const filterValue = (event.target as HTMLInputElement).value;
|
||||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
this.businessList.filter = filterValue.trim().toLowerCase();
|
||||||
if (this.dataSource.paginator) {
|
if (this.businessList.paginator) {
|
||||||
this.dataSource.paginator.firstPage();
|
this.businessList.paginator.firstPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
constructor(public dialog: MatDialog) { }
|
|
||||||
|
|
||||||
confirmBox(name,element){
|
confirmBox(name,element){
|
||||||
console.log(name,element)
|
console.log(name,element)
|
||||||
@ -140,8 +167,5 @@ export class BusinessListComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
console.log(this.dataSource)
|
console.log(this.dataSource)
|
||||||
}
|
}
|
||||||
ngOnInit(): void {
|
|
||||||
this.dataSource = new MatTableDataSource(ELEMENT_DATA)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,29 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { environment } from 'environments/environment';
|
||||||
|
import { Observable, of } from 'rxjs';
|
||||||
|
import { catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class BusinessService {
|
export class BusinessService {
|
||||||
|
private apiUrl = environment.apiEndpoint;
|
||||||
|
|
||||||
|
constructor(private _http: HttpClient) { }
|
||||||
|
|
||||||
|
getBusinessListDetails(): Observable<any>{
|
||||||
|
return this._http.get<any[]>(this.apiUrl + "businessDetailList")
|
||||||
|
.pipe(
|
||||||
|
catchError(this.handleError('role', []))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleError<T>(operation = 'operation', result?: T) {
|
||||||
|
return (error: any): Observable<T> => {
|
||||||
|
return of(result as T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<ng-scrollbar class="scrollHV">
|
<ng-scrollbar class="scrollHV">
|
||||||
<div fxLayout="row wrap" >
|
<div fxLayout="row wrap mt-2 mb-2">
|
||||||
<div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="33.33" fxFlex.xl="33.33" class="m-gap p-gap" *ngFor="let consultant of consultants">
|
<div fxFlex.xs="100" fxFlex.sm="50" fxFlex.md="50" fxFlex.lg="33.33" fxFlex.xl="33.33" class="m-gap p-gap" *ngFor="let consultant of consultants">
|
||||||
<div class="consultant-list-card">
|
<div class="consultant-list-card">
|
||||||
<div class="consultant-content">
|
<div class="consultant-content">
|
||||||
|
|||||||
@ -10,7 +10,7 @@ $black_60: rgba(0, 0, 0, 0.6);
|
|||||||
padding-bottom: 4rem;
|
padding-bottom: 4rem;
|
||||||
}
|
}
|
||||||
.scrollHV {
|
.scrollHV {
|
||||||
height: calc(100vh - 410px);
|
height: calc(100vh - 105px);
|
||||||
}
|
}
|
||||||
.consultant-list-card {
|
.consultant-list-card {
|
||||||
background: $white;
|
background: $white;
|
||||||
|
|||||||
@ -44,16 +44,16 @@ export class CustomersListComponent implements OnInit {
|
|||||||
@ViewChild(MatTable,{static:true}) table: MatTable<any>;
|
@ViewChild(MatTable,{static:true}) table: MatTable<any>;
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
recordStatus: boolean;
|
recordStatus: boolean;
|
||||||
length = 5;
|
// length = 5;
|
||||||
pageIndex = 0;
|
// pageIndex = 0;
|
||||||
pageSize = 10;
|
// pageSize = 10;
|
||||||
pageEvent: PageEvent;
|
// pageEvent: PageEvent;
|
||||||
addFormData: any;
|
addFormData: any;
|
||||||
|
|
||||||
constructor(public dialog: MatDialog,public _cus:CustomersService) { }
|
constructor(public dialog: MatDialog,public _cus:CustomersService) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log('IN')
|
// console.log('IN')
|
||||||
// this.dataSource = new MatTableDataSource(ELEMENT_DATA)
|
// this.dataSource = new MatTableDataSource(ELEMENT_DATA)
|
||||||
this.getCustomersList()
|
this.getCustomersList()
|
||||||
}
|
}
|
||||||
@ -76,7 +76,6 @@ export class CustomersListComponent implements OnInit {
|
|||||||
// this.recordStatus=true;
|
// this.recordStatus=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// , error => {this.errorMessage = <any> error});
|
|
||||||
,error => {
|
,error => {
|
||||||
// this.errorMessage.push(error);
|
// this.errorMessage.push(error);
|
||||||
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
// this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
|
|||||||
@ -13,14 +13,9 @@ export class SessionService {
|
|||||||
|
|
||||||
getLoginToken(params): Observable<any> {
|
getLoginToken(params): Observable<any> {
|
||||||
console.log(params.email)
|
console.log(params.email)
|
||||||
return this._http.post(this.apiUrl + 'login', {'email':params.email,'password':params.password})
|
return this._http.post<any>(this.apiUrl + "login",{'email':params.email,'password':params.password})
|
||||||
.pipe(
|
// return this._http.post(this.apiUrl + 'login', {'email':params.email,'password':params.password})
|
||||||
catchError(this.handleError('role', []))
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
private handleError<T>(operation = 'operation', result?: T) {
|
|
||||||
return (error: any): Observable<T> => {
|
|
||||||
return of(result as T);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user