fixed HTTP posts

This commit is contained in:
piratefinn 2017-11-15 14:46:04 +00:00
parent b8775e2e45
commit 5ed6bfe7f3

View file

@ -20,7 +20,7 @@ export class ApiService {
public post(url: string, data: any = {}) { public post(url: string, data: any = {}) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + url, this.apiUrl + url,
data data
); );
@ -46,7 +46,7 @@ export class ApiService {
} }
public register(data) { public register(data) {
return this.http.post( return this.http.post<any>(
this.apiUrl + '/register', this.apiUrl + '/register',
data data
); );
@ -54,13 +54,13 @@ export class ApiService {
public login(data) { public login(data) {
return this.http return this.http
.post( .post<any>(
this.apiUrl + '/login', this.apiUrl + '/login',
data data
) )
.map( .map(
result => { result => {
const json = result.json(); const json = result;
this.setSessionKey(json.session_key); this.setSessionKey(json.session_key);
this.setUserInfo( this.setUserInfo(
json.email, json.email,
@ -76,7 +76,7 @@ export class ApiService {
console.log(this.sessionKey); console.log(this.sessionKey);
const key = this.sessionKey; const key = this.sessionKey;
return this.http return this.http
.post( .post<any>(
this.apiUrl + '/logout', this.apiUrl + '/logout',
{ session_key : key }, { session_key : key },
) )
@ -84,7 +84,7 @@ export class ApiService {
response => { response => {
localStorage.clear(); localStorage.clear();
this.sessionKey = null; this.sessionKey = null;
return response.json(); return response;
} }
); );
} }
@ -97,7 +97,7 @@ export class ApiService {
data.version_code = 'dev'; data.version_code = 'dev';
data.version_number = 'dev'; data.version_number = 'dev';
console.log(data); console.log(data);
return this.http.post( return this.http.post<any>(
this.apiUrl + '/feedback', this.apiUrl + '/feedback',
data data
); );
@ -107,7 +107,7 @@ export class ApiService {
public transList(data) { public transList(data) {
const key = this.sessionKey; const key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/outgoing-transactions', this.apiUrl + '/outgoing-transactions',
{ {
session_key : key, session_key : key,
@ -120,7 +120,7 @@ export class ApiService {
public search(data) { public search(data) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/search', this.apiUrl + '/search',
data data
); );
@ -130,7 +130,7 @@ export class ApiService {
public upload(data) { public upload(data) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/upload', this.apiUrl + '/upload',
data data
); );
@ -140,7 +140,7 @@ export class ApiService {
public payrollList(data) { public payrollList(data) {
const key = this.sessionKey; const key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/v1/organisation/payroll', this.apiUrl + '/v1/organisation/payroll',
{ {
session_key : key, session_key : key,
@ -153,7 +153,7 @@ export class ApiService {
public orgPayroll(data) { public orgPayroll(data) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/v1/organisation/payroll/add', this.apiUrl + '/v1/organisation/payroll/add',
data data
); );
@ -161,7 +161,7 @@ export class ApiService {
public orgSupplier(data) { public orgSupplier(data) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/v1/organisation/supplier/add', this.apiUrl + '/v1/organisation/supplier/add',
data data
); );
@ -169,7 +169,7 @@ export class ApiService {
public orgEmployee(data) { public orgEmployee(data) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/v1/organisation/employee/add', this.apiUrl + '/v1/organisation/employee/add',
data data
); );
@ -204,7 +204,7 @@ export class ApiService {
public accountFullLoad() { public accountFullLoad() {
const key = this.sessionKey; const key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/user', this.apiUrl + '/user',
{ session_key : key }, { session_key : key },
); );
@ -212,7 +212,7 @@ export class ApiService {
public accountEditUpdate(data) { public accountEditUpdate(data) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/user/account', this.apiUrl + '/user/account',
data data
); );
@ -257,7 +257,7 @@ export class ApiService {
type: string, type: string,
page: number) { page: number) {
const key = this.sessionKey; const key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/stats/leaderboard/paged', this.apiUrl + '/stats/leaderboard/paged',
{ {
session_key : key, session_key : key,
@ -270,7 +270,7 @@ export class ApiService {
// Initial Map Data // Initial Map Data
public getMapData(data) { public getMapData(data) {
data.session_key = this.sessionKey; data.session_key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/v1/supplier/location', this.apiUrl + '/v1/supplier/location',
data data
); );
@ -279,7 +279,7 @@ export class ApiService {
// Basic Customer User stats API // Basic Customer User stats API
public basicStats() { public basicStats() {
const key = this.sessionKey; const key = this.sessionKey;
return this.http.post( return this.http.post<any>(
this.apiUrl + '/stats', this.apiUrl + '/stats',
{ {
session_key : key, session_key : key,