租房小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
749 B

3 months ago
  1. import { formatObjKey } from '../utils/formatObjKey';
  2. /*
  3. * getAsyncFetch
  4. * @param {String} asyncFetch taskId
  5. * @param {Object} options
  6. */
  7. export async function getAsyncFetch(this: any, taskId, options: any = {}): Promise<object> {
  8. options.subres = Object.assign({ asyncFetch: '' }, options.subres);
  9. options.headers = options.headers || {};
  10. const params = this._objectRequestParams('GET', '', options);
  11. params.headers['x-oss-task-id'] = taskId;
  12. params.successStatuses = [200];
  13. params.xmlResponse = true;
  14. const result = await this.request(params);
  15. const taskInfo = formatObjKey(result.data.TaskInfo, 'firstLowerCase');
  16. return {
  17. res: result.res,
  18. status: result.status,
  19. state: result.data.State,
  20. taskInfo
  21. };
  22. }