Skip to content

Instantly share code, notes, and snippets.

@narennaik
Last active June 29, 2021 09:02
Show Gist options
  • Save narennaik/ed55b076a78c9973d97e7251a8d45ae4 to your computer and use it in GitHub Desktop.
Save narennaik/ed55b076a78c9973d97e7251a8d45ae4 to your computer and use it in GitHub Desktop.
adding new feature
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