How to access config api url from browser window object?

52 Views Asked by At

I've a react library that is said to get the config URL from windows object on runtime like below.

window.config.api_url

And in the consumer application which uses the library, i'm trying to set this like, so that library can access to this api url

window.config = { api_url: 'http://something.com}

But it's not working and it's always undefined, if I put a console in the library

console.log(window.config.api_url)
0

There are 0 best solutions below