Commit e534ddc5 authored by saliou673's avatar saliou673
Browse files

fix userinfo type

parent 1c9c558e
......@@ -5,6 +5,7 @@ import {HttpClient} from "@angular/common/http";
import {ToastrService} from 'ngx-toastr';
import {Router} from "@angular/router";
import {Global} from "../global-classes/global";
import { User } from '../model/user'
@Component({
selector: 'app-login',
......@@ -49,7 +50,7 @@ export class LoginComponent implements OnInit {
this.router.navigate(["/"]);
this.jwtClientService.connect(data.toString())
this.toastr.success("Bon retour parmis nous " + authRequest.userName + " !")
this.http.get<Array<Object>>(this.baseUrl + '?username=' + authRequest.userName).subscribe(data => {
this.http.get<Array<User>>(this.baseUrl + '?username=' + authRequest.userName).subscribe(data => {
if (data.length > 0) {
JwtClientService.userInfo = data[0];
}
......
......@@ -3,6 +3,7 @@ import {HttpClient, HttpHeaders} from "@angular/common/http";
import {Observable} from "rxjs";
import { CookieService } from 'ngx-cookie-service';
import { Router } from '@angular/router';
import { User } from '../model/user'
@Injectable({
providedIn: 'root'
......@@ -12,7 +13,7 @@ export class JwtClientService {
public static isAuth: boolean = false;
public static currentToken : string = "";
baseUrl: string = "http://127.0.0.1:8000/api/v1/users";
public static userInfo = {}
public static userInfo:User
constructor(private http: HttpClient,
private cookie: CookieService) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment