isolamento de pacote
This commit is contained in:
commit
f34b66cbe4
96 changed files with 2285 additions and 0 deletions
44
src/autenticacao/_usuarios_quipo.ts
Normal file
44
src/autenticacao/_usuarios_quipo.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import node_fetch from "cross-fetch"
|
||||
import { respostaComuns, type tipoResposta } from "p-respostas"
|
||||
import type { tipo_usuarios__listar_retorno } from "../lista-usuarios"
|
||||
|
||||
export type tipoUsuarioExterno = {
|
||||
_nome: string
|
||||
_email: string
|
||||
_telefone: string
|
||||
vinculo: string
|
||||
inquilino: string
|
||||
chave_produto: string
|
||||
codigo: string
|
||||
_cpf: string
|
||||
}
|
||||
|
||||
export const usuarios_quipo = async ({
|
||||
token_produto,
|
||||
url_api_autenticacao,
|
||||
inquilino,
|
||||
}: {
|
||||
url_api_autenticacao: string
|
||||
token_produto: string
|
||||
inquilino: string
|
||||
}): Promise<tipoResposta<tipo_usuarios__listar_retorno[]>> => {
|
||||
const url = `${url_api_autenticacao}/api/usuarios__listar`
|
||||
|
||||
if (!token_produto) return respostaComuns.erro("token_produto não informado")
|
||||
|
||||
const headers = {
|
||||
token: token_produto,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
return node_fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ inquilino }),
|
||||
headers,
|
||||
})
|
||||
.then((r) => r.json())
|
||||
.catch((e) =>
|
||||
respostaComuns.erro(`Erro ao buscar usuários quipo governo ${e.message}`),
|
||||
)
|
||||
.then((r) => r as tipoResposta<tipo_usuarios__listar_retorno[]>)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue