I'm trying to make a request to an ip with a port, eg: http://10.113.132.457:32001
But when I make the request I get the following error:
Unhandled promise rejection TypeError: "Expected "32001" to be a string"
I've tried removing the port from the url and add again on a hook but without success
hooks: {
before({ payload, next }) {
const url = new URL(payload.url)
url.port = '32001'
payload.url = url.toString()
next(payload)
}
}
I've the following structure for the services
export const BaseService = new ApiService({
adapter: xhr, // ie11
url: process.env.SERVICE_URL,
mode: 'cors',
})
export const AvailabilityService = {
url: 'checkAvailability',
children: [
{
name: 'getAvailability',
method: 'GET'
}
],
hooks: {
before({ payload, next }) {
const url = new URL(payload.url)
url.port = '32001'
payload.url = url.toString()
next(payload)
}
}
}
And then in my component
const { success, result } = await api('getAvailability').doSingleRequest({
query: params
})
I'm doing something wrong?
I'm trying to make a request to an ip with a port, eg: http://10.113.132.457:32001
But when I make the request I get the following error:
Unhandled promise rejection TypeError: "Expected "32001" to be a string"I've tried removing the port from the url and add again on a hook but without success
I've the following structure for the services
And then in my component
I'm doing something wrong?