Bom dia pessoal!
Estou fazendo um projeto de teste do POUI, e já fiz a API em TLPP mas não consegui chamar dentro do protheus. Fazendo o login no navegador consegui pegar o token e assim comunicar a API trazendo todos os dados. O problema é que quando tento chamar a aplicação dentro do protheus, a tela fica em um carregamento infinito, o protheus-lib-core já está instalado no projeto. Dessa forma alguém consegue me ajudar a solucionar este problema?
Desde já eu Agradeço!
Atenção: Esta publicação foi transferida automaticamente do fórum antigo, mas os anexos não foram incluídos.
eu cheguei a desenvolver uma, mas utilizado rest ADVPL, no caso tiver que fazer umas configurações na aplicação do PO-UI.
um import { ProAppConfigService, ProJsToAdvplService } from '@totvs/protheus-lib-core';
É faz passar no construtor para fazer injectable.
constructor(
private readonly router: Router,
private proAppConfigService: ProAppConfigService,
private proJsToAdvplService: ProJsToAdvplService,
private poNotification: PoNotificationService,
private http: HttpClient
) {
if (!this.proAppConfigService.insideProtheus()) {
this.proAppConfigService.loadAppConfig();
}
async loadAppConfig(): Promise<string> {
try {
const response = await firstValueFrom(this.http.get<any>('assets/data/appConfig.json'));
this.endPointProt = response.api_baseUrl;
this.endPointProt = response.api_baseUrl
this.poNotification.information('Endpoint Rest [JsonConfig] : ' + this.endPointProt);
return response.api_baseUrl
} catch (error) {
//console.error('Error loading app config', error);
throw error; // You might want to handle the error appropriately in your application
}
/*configuração do arquivo appConfig.json
{
"name": "My Protheus App",
"version": "1.0.0",
"api_baseUrl": "/",
"productLine": "Protheus"
}
*/
}
Tudo isso foi feito com base nesse artigo do Daniel Mendes https://medium.com/totvsdevelopers/apps-no-protheus-10db4f47f9fc , tem um github com exemplo.