|
@@ -5,11 +5,11 @@ import { RequestOptions } from '@angular/http';
|
|
|
|
|
|
@Injectable()
|
|
@Injectable()
|
|
export class NetworkService {
|
|
export class NetworkService {
|
|
- headers:any;
|
|
|
|
- options:any
|
|
|
|
|
|
+ headers: any;
|
|
|
|
+ options: any
|
|
public config: any = {
|
|
public config: any = {
|
|
dev: 'http://127.0.0.1:6006/',
|
|
dev: 'http://127.0.0.1:6006/',
|
|
- prod: 'http://192.168.42.157:6006/'
|
|
|
|
|
|
+ prod: 'http://192.168.43.169:6006/'
|
|
}
|
|
}
|
|
constructor(
|
|
constructor(
|
|
public http: HttpClient,
|
|
public http: HttpClient,
|
|
@@ -21,7 +21,7 @@ export class NetworkService {
|
|
* @param url
|
|
* @param url
|
|
*/
|
|
*/
|
|
ajaxGet(url: any, json?: Object) {
|
|
ajaxGet(url: any, json?: Object) {
|
|
- let api =this.config.prod+url;
|
|
|
|
|
|
+ let api = this.config.prod + url;
|
|
return new Promise((resove, reject) => {
|
|
return new Promise((resove, reject) => {
|
|
this.http.get(api).subscribe((response) => {
|
|
this.http.get(api).subscribe((response) => {
|
|
resove(response);
|
|
resove(response);
|
|
@@ -49,8 +49,8 @@ export class NetworkService {
|
|
ajaxPost(url: any, json?: Object) {
|
|
ajaxPost(url: any, json?: Object) {
|
|
console.log(url)
|
|
console.log(url)
|
|
console.log(json)
|
|
console.log(json)
|
|
- let api =this.config.prod+url;
|
|
|
|
- return new Promise((resove, reject) => {
|
|
|
|
|
|
+ let api = this.config.prod + url;
|
|
|
|
+ return new Promise((resove, reject) => {
|
|
this.http.post(api, json).subscribe((response) => {
|
|
this.http.post(api, json).subscribe((response) => {
|
|
resove(response);
|
|
resove(response);
|
|
}, (error) => {
|
|
}, (error) => {
|
|
@@ -67,7 +67,7 @@ export class NetworkService {
|
|
*/
|
|
*/
|
|
ajaxPut(url: any, json?: Object) {
|
|
ajaxPut(url: any, json?: Object) {
|
|
// var api = this.config.domain + url;
|
|
// var api = this.config.domain + url;
|
|
- let api =this.config.prod+url;
|
|
|
|
|
|
+ let api = this.config.prod + url;
|
|
return new Promise((resove, reject) => {
|
|
return new Promise((resove, reject) => {
|
|
this.http.put(api, json).subscribe((response) => {
|
|
this.http.put(api, json).subscribe((response) => {
|
|
resove(response);
|
|
resove(response);
|
|
@@ -84,7 +84,7 @@ export class NetworkService {
|
|
*/
|
|
*/
|
|
ajaxDelete(url: any, json?: Object) {
|
|
ajaxDelete(url: any, json?: Object) {
|
|
// var api = this.config.domain + url;
|
|
// var api = this.config.domain + url;
|
|
- let api =this.config.dev+url;
|
|
|
|
|
|
+ let api = this.config.dev + url;
|
|
return new Promise((resove, reject) => {
|
|
return new Promise((resove, reject) => {
|
|
this.http.delete(api, json).subscribe((response) => {
|
|
this.http.delete(api, json).subscribe((response) => {
|
|
resove(response);
|
|
resove(response);
|