I want to set dynamic links to a href link. What i exactly need to do is to call a js method which returns the url according to domain inside the a href.
<a href="javascript:getAuthUrl()"><u>Login>></u></a>
function getAuthUrl() {
...
if (domain.includes("localhost")) {
return buildOAuthUrl(hostConfig.dev);
}
else if (domain.includes("...")) {
return buildOAuthUrl(hostConfig.test);
}
else if (domain.includes("....")) {
return buildOAuthUrl(hostConfig.uat);
}
else if (domain.includes("....")) {
return buildOAuthUrl(hostConfig.prod);
}
else if (domain.includes("....")) {
return buildOAuthUrl(hostConfig.test);
}
else {
return buildOAuthUrl(hostConfig.dev);
}
}
}
I tried some examples in stackoverflow but that didn't solve my error/problem.