// Função de comunicação com a rota mounting, para a construção do ambiente do usuário async function Autenticao() { const apiUrl = await getApiUrl(); const token = getAuthToken(); const response = await fetch(`${apiUrl}/mounting`, { method: 'GET', headers: { 'Content-Type': 'application/json', 'x-access-token': token ? token : '' } }); return { response, apiUrl }; // Retorne um objeto com a resposta e apiUrl } async function IntegracaoZamade() { const apiUrl = await getApiUrl(); const token = getAuthToken(); if (!apiUrl || !token) { throw new Error("Erro: Parâmetros obrigatórios ausentes (apiUrl, token ou domain)"); } const Chamados = await fetch(`${apiUrl}/tickets`, { method: 'GET', headers: { 'Content-Type': 'application/json', 'x-access-token': token, //'Id_Cliente': domain } }); if (!Chamados.ok) { throw new Error(`Erro na API: ${Chamados.status} - ${Chamados.statusText}`); } return { Chamados, apiUrl }; // Retorna a resposta e a URL } async function IntegracaoZamade() { const apiUrl = await getApiUrl(); const token = getAuthToken(); if (!apiUrl || !token) { throw new Error("Erro: Parâmetros obrigatórios ausentes (apiUrl, token ou domain)"); } const Chamados = await fetch(`${apiUrl}/tickets`, { method: 'GET', headers: { 'Content-Type': 'application/json', 'x-access-token': token, //'Id_Cliente': domain } }); if (!Chamados.ok) { throw new Error(`Erro na API: ${Chamados.status} - ${Chamados.statusText}`); } return { Chamados, apiUrl }; // Retorna a resposta e a URL } async function IntegracaoBoleto() { const apiUrl = await getApiUrl(); const token = getAuthToken(); if (!apiUrl || !token) { throw new Error("Erro: Parâmetros obrigatórios ausentes (apiUrl, token ou domain)"); } const Boleto = await fetch(`${apiUrl}/boletos`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-access-token': token, //'Id_Cliente': domain } }); if (!Boleto.ok) { throw new Error(`Erro na API: ${Boleto.status} - ${Boleto.statusText}`); } return { Boleto, apiUrl }; // Retorna a resposta e a URL }