Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //import { Subject } from 'rxjs/Subject';
- //import { Observable } from 'rxjs/Observable';
- //import * as io from 'socket.io-client';
- import {Http, Headers} from '@angular/http';
- import {Inject} from "@angular/core";
- import map = require("core-js/fn/array/map");
- import 'rxjs/add/operator/map';
- import {bindRenderText} from "@angular/compiler/src/view_compiler/property_binder";
- export class LoginService{
- public isLogin: boolean;
- public isInLogin: boolean;
- public lePseudo: string;
- constructor(@Inject(Http) private http:Http){
- }
- getUser(pseudo,password){
- let newUser={
- pseudo : pseudo,
- password : password
- }
- var headers = new Headers();
- headers.append('Content-Type', 'application/json');
- //this.isInLogin = true;
- this.http.post('http://localhost:3000/login/getUser/', JSON.stringify(newUser), {headers})
- .subscribe(
- data => {
- console.log("biiiiiiiiiiiiiiiiiiiii "+newUser.pseudo);
- console.log("biiiiiiiiiiiiiiiiiiiii "+data.json());
- if(data.json()){
- this.lePseudo = newUser.pseudo;
- this.isLogin = true;
- console.log("affiche moi getUser isloggin: " + this.isLogin);
- return this.isLogin;
- }else {
- this.lePseudo = "Pseudo Pas definit";
- this.isLogin = false;
- console.log("affiche moi getUser isloggin: " + this.isLogin);
- return this.isLogin;
- }
- }
- );
- console.log("return this.isLogin : "+this.isLogin);
- return this.isLogin;
- }
- /*
- isTrue(pseudo,password){
- this.getUser(pseudo,password);
- console.log("affiche moi ce putin de isloggin: " + this.isLogin);
- return this.isLogin;
- }
- monPseudo(){
- console.log("affiche moi ce putin de pseudo: " + this.lePseudo);
- return this.lePseudo;
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement