Fixed types and missing imports

This commit is contained in:
Denys Vuika
2016-04-18 15:52:23 +01:00
parent 1e6d69f6cc
commit 2e74d5fe3c
2 changed files with 9 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
import {Injectable} from "angular2/core"; import {Injectable} from "angular2/core";
import {Observable} from 'rxjs/Rx'; import {Observable} from 'rxjs/Rx';
import {Http, Headers, URLSearchParams} from 'angular2/http'; import {Http, Headers, URLSearchParams, Response} from 'angular2/http';
declare var xml2json:any;
@Injectable() @Injectable()
export class Authentication { export class Authentication {
@@ -17,7 +19,7 @@ export class Authentication {
return !!localStorage.getItem('token'); return !!localStorage.getItem('token');
} }
login(method:String, username:String, password:String) { login(method:string, username:string, password:string) {
if (method === 'GET') { if (method === 'GET') {
return this.loginGet(username, password); return this.loginGet(username, password);
} else { } else {
@@ -25,8 +27,8 @@ export class Authentication {
} }
} }
loginGet(username:String, password:String) { loginGet(username:string, password:string) {
const searchParams = new URLSearchParams() const searchParams = new URLSearchParams();
searchParams.set('u', username); searchParams.set('u', username);
searchParams.set('pw', password); searchParams.set('pw', password);
@@ -39,7 +41,7 @@ export class Authentication {
.catch(this.handleError); .catch(this.handleError);
} }
loginPost(username:String, password:String) { loginPost(username:string, password:string) {
var credentials = "{ username: " + username+ ", password: "+ password +" }"; var credentials = "{ username: " + username+ ", password: "+ password +" }";
var headers = new Headers(); var headers = new Headers();

View File

@@ -8,7 +8,8 @@
"tsc:w": "tsc -w", "tsc:w": "tsc -w",
"lite": "lite-server", "lite": "lite-server",
"typings": "typings", "typings": "typings",
"postinstall": "typings install" "postinstall": "typings install",
"build": "tsc -p .; exit 0"
}, },
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {