Versão atual:

[Protheus-lib-core] - Função ProGenericAdapterService

Criei um projeto simples para entender algumas funções do protheus-lib-core. E fiz o teste abaixo conforme exemplo:

import { ProGenericAdapterService, ProAdapterListInterface, ProAdapterQueryInterface } from '@totvs/protheus-lib-core';

genericQueryAdapter(){
  let adapterList: ProAdapterQueryInterface = {
    tables: this.genericAdapter.table,
    fields: this.genericAdapter.fields,
    quickSearch: this.genericAdapter.quicksearch
  };
  this.proGenericAdapterService.query(adapterList).subscribe({
    next: apiReturn => {
      console.log(apiReturn);
      let propriedades = this.genericAdapter.fields.split(',');
      let arrayJSON = propriedades.map((propriedade) => {
        return { property: propriedade };
      });
      this.table.items = apiReturn.items;
      this.table.columns = arrayJSON;
    }
  });
}

Porém dá erro de status 0. E verifiquei o seguinte:

O Url está sendo construída assim http://127.0.0.1:4090/rest/api/framework/v1/genericList , mas o correto deveria ser assim http://127.0.0.1:4090/rest/api/framework/v1/genericList?alias=SRA&fields=RA_NOME.

Alguém já usou essa função e poderia ajudar?

Versões (3):

Ver a versão formatada

[Protheus-lib-core] - Função ProGenericAdapterService

Comentário

new question