mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Fixed types and missing imports
This commit is contained in:
@@ -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();
|
||||||
|
@@ -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": {
|
||||||
|
Reference in New Issue
Block a user