Last active
June 29, 2021 09:02
-
-
Save narennaik/ed55b076a78c9973d97e7251a8d45ae4 to your computer and use it in GitHub Desktop.
adding new feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const REDIRECT_URL = CONFIG.serverRedirectURL; | |
const isDomainValid = (item) => item.detatils.valid; | |
const getProtocol = (item) => (isDomainValid(item) ? 'https' : 'http'); | |
const getDomainName = (item) => item.details.name; | |
const getUrl = (item) => `${getProtocol(item)}://${getDomainName(item)}?}`; | |
// TODO: (temporary) Adding callback=true because server side redirection needs this parameter | |
const addCallbackParameter = (url) => `${url}&callback=true`; | |
// URL needs to be added from the deployment config | |
const addRedirectUrlParameter = (url) => | |
`${url}&redirect_url=${REDIRECT_URL}`; | |
const addParameters = R.pipe(addCallbackParameter, addRedirectUrlParameter); | |
const generateUrlWithParameters = R.pipe(getUrl, addParameters); | |
const urlList = domainList.map(generateUrl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment