This commit is contained in:
andreLMpena 2024-12-02 11:10:53 -03:00
parent 0172055539
commit d5353fdaf1
4 changed files with 10 additions and 4 deletions

View file

@ -2,13 +2,15 @@ import node_fetch from "cross-fetch";
import { respostaComuns } from "p-respostas"; import { respostaComuns } from "p-respostas";
import { urlAutenticacao } from "./_urlAutenticacao"; import { urlAutenticacao } from "./_urlAutenticacao";
export const usuarios_quipo = async ({ token_produto, ambiente, tipo, }) => { export const usuarios_quipo = async ({ token_produto, ambiente, tipo, }) => {
const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo/${tipo}`; const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo`;
if (!token_produto) if (!token_produto)
return respostaComuns.erro("token_produto não informado"); return respostaComuns.erro("token_produto não informado");
const headers = { const headers = {
token: token_produto, token: token_produto,
}; };
return node_fetch(url, { return node_fetch(url, {
method: "POST",
body: JSON.stringify({ tipo }),
headers, headers,
}) })
.then((r) => r.json()) .then((r) => r.json())

View file

@ -8,13 +8,15 @@ const cross_fetch_1 = __importDefault(require("cross-fetch"));
const p_respostas_1 = require("p-respostas"); const p_respostas_1 = require("p-respostas");
const _urlAutenticacao_1 = require("./_urlAutenticacao"); const _urlAutenticacao_1 = require("./_urlAutenticacao");
const usuarios_quipo = async ({ token_produto, ambiente, tipo, }) => { const usuarios_quipo = async ({ token_produto, ambiente, tipo, }) => {
const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/usuarios_quipo/${tipo}`; const url = `${(0, _urlAutenticacao_1.urlAutenticacao)(ambiente)}/api/usuarios_quipo`;
if (!token_produto) if (!token_produto)
return p_respostas_1.respostaComuns.erro("token_produto não informado"); return p_respostas_1.respostaComuns.erro("token_produto não informado");
const headers = { const headers = {
token: token_produto, token: token_produto,
}; };
return (0, cross_fetch_1.default)(url, { return (0, cross_fetch_1.default)(url, {
method: "POST",
body: JSON.stringify({ tipo }),
headers, headers,
}) })
.then((r) => r.json()) .then((r) => r.json())

View file

@ -1,6 +1,6 @@
{ {
"name": "p-drives", "name": "p-drives",
"version": "0.189.0", "version": "0.190.0",
"description": "", "description": "",
"main": "src/index.ts", "main": "src/index.ts",
"exports": { "exports": {

View file

@ -24,7 +24,7 @@ export const usuarios_quipo = async ({
token_produto: string token_produto: string
tipo: tipos_de_acesso_quipo tipo: tipos_de_acesso_quipo
}): Promise<tipoResposta<tipoUsuarioExterno[]>> => { }): Promise<tipoResposta<tipoUsuarioExterno[]>> => {
const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo/${tipo}` const url = `${urlAutenticacao(ambiente)}/api/usuarios_quipo`
if (!token_produto) return respostaComuns.erro("token_produto não informado") if (!token_produto) return respostaComuns.erro("token_produto não informado")
@ -33,6 +33,8 @@ export const usuarios_quipo = async ({
} }
return node_fetch(url, { return node_fetch(url, {
method: "POST",
body: JSON.stringify({ tipo }),
headers, headers,
}) })
.then((r) => r.json()) .then((r) => r.json())