Proceso completo de solicitud de activacion
This commit is contained in:
@@ -11,7 +11,7 @@ export namespace SimEvents {
|
||||
}
|
||||
|
||||
export type activation = DomainEvent & {
|
||||
key: "sim.activation",
|
||||
key: `sim.${string}.activation`,
|
||||
payload: {
|
||||
iccid: string
|
||||
},
|
||||
@@ -20,7 +20,7 @@ export namespace SimEvents {
|
||||
}
|
||||
|
||||
export type cancelation = DomainEvent & {
|
||||
key: "sim.cancelation",
|
||||
key: `sim.${string}.cancelation`,
|
||||
payload: {
|
||||
iccid: string
|
||||
},
|
||||
|
||||
@@ -30,12 +30,12 @@ export class HttpClient {
|
||||
async (config) => {
|
||||
// Idealmente estas condiciones no deberian de darse si mantenemos el
|
||||
// token valido de forma preventiva
|
||||
const token = this.jwtManager.authToken?.rawToken
|
||||
const token = await this.jwtManager.getAccessToken()
|
||||
|
||||
if (token == undefined) throw new Error("No se ha obtenido el token para la peticion")
|
||||
|
||||
config.headers.Authorization = `Bearer ${this.jwtManager.authToken!.rawToken}`
|
||||
console.log("request completa", config.headers, config.data)
|
||||
console.log("request completa", config.data)
|
||||
return config;
|
||||
},
|
||||
(error) => Promise.reject(error)
|
||||
@@ -49,7 +49,7 @@ export class HttpClient {
|
||||
async (error) => {
|
||||
// TODO: Esta parte no tiene tipos, hay que asegurar el error
|
||||
const req = error.config
|
||||
console.error("[http] Error en la respuesta ", error)
|
||||
console.error("[http] Error en la respuesta ", error.response.data)
|
||||
if (error.response?.status == 401) {
|
||||
this.jwtManager.getAccessToken()
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ export class RabbitMQEventBus implements EventBus {
|
||||
protected async createChannel() {
|
||||
if (this.connection == undefined) throw new Error("[RMQ] Intentando crear un canal sin una conexion")
|
||||
const channel = this.connection.createChannel({
|
||||
json: true,
|
||||
setup: (channel: Channel) => {
|
||||
// Exchanges comunes a todos
|
||||
channel.assertExchange("sim.exchange", "topic", { durable: true })
|
||||
|
||||
Reference in New Issue
Block a user