Currently, I'm working on reading URL from the browser and assigning that as global URL, instead of hardcoding the base_url
I need it to be read from the browser and patch that to the all the service with the URL. I have tried doing this and this code works but the problem is once the screen is reloaded all the APIs are going to fail.
CODE
setTimeout(() => {
if (environment.production) {
base_url = window.location.origin + '/APPLICATION/resources/';
}else {
base_url = 'http://106.51.66.219:1234/APPLICATION/resources/' ;
}
}, 1000);
is there any better way to set the base_url
and it works flawlessly even after clicking of the refresh.