新版Clever前端請求介面格式

weixin_34320159發表於2018-06-23
private httpDemo() {
  const incrementParams: IncrementParams = {
    route: '/login/test22222',
    uid: '6',
    orderBy: [{
      colIndex: 1,
      orderType: 'DESC'
    }, {
      colIndex: 2,
      orderType: 'ASC'
    }]
  };
  const reqStructure: RequsetStructure = {
    reqParams: {
      name: 'randy',
      number: '123456'
    },
    withCredentials: true
  };
  const reqStructure2: RequsetStructure = {
    reqParams: {
      name: 'vivian',
      number: 'qwerasdf'
    },
    withCredentials: true
  };
  // const submitUrl = 'https://www.sojson.com/open/api/weather/json.shtml?city=長春';
  this.submitService.getHttpSubmit('/req-template/test1111', true, reqStructure)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
  this.submitService.postHttpSubmit('/req-template/test1111', true, reqStructure2)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
  this.submitService.getHttpSubmit('/req-template/test2222', true, reqStructure, incrementParams)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
  this.submitService.postHttpSubmit('/req-template/test2222', true, reqStructure2, incrementParams)
    .subscribe(data => alert(JSON.stringify(data)), error => {
      console.log(error)
    });
}

相關文章