// TODO for demo purposes
export const redirectToProductOnClick = (redirectInfo, tenantId) => {
    // const { externalAppURL, unityuser, method } = redirectInfo;
    let urlEndpoint = `${redirectInfo}?tenantId=${tenantId}`;
    // let unityToken = sessionStorage.getItem(
    //   `msal.${process.env.REACT_APP_MSAL_CLIENT_ID}.idtoken`
    // );
    window.open(urlEndpoint, '_blank');
    // ulrEndpoint = `${externalAppURL}?unityb2ctoken=${unityToken}&unityuser=${unityuser}`;
    // if (method === 'GET') {
    //   window.open(ulrEndpoint, '_blank');
    // } else {
    //   openWindowWithPost(externalAppURL, unityuser, unityToken);
    // }
};
// TODO for demo purposes
const openWindowWithPost = (url, user, token) => {
    let form = document.createElement('form');
    form.target = '_blank';
    form.method = 'POST';
    form.action = url;
    form.style.display = 'none';
    let inputUser = document.createElement('input');
    inputUser.type = 'hidden';
    inputUser.name = 'unityuser';
    inputUser.value = user;
    form.appendChild(inputUser);
    let inputToken = document.createElement('input');
    inputToken.type = 'hidden';
    inputToken.name = 'unityb2ctoken';
    inputToken.value = token;
    form.appendChild(inputToken);
    document.body.appendChild(form);
    form.submit();
    document.body.removeChild(form);
};
// TODO AXIOS
// axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*';
// axios
//   .post(ulrEndpoint, bodyParameters, config)
//   .then(res => {
//     console.log(res);
//     debugger;
//     window.open(ulrEndpoint, '_blank');
//   })
//   .catch(error => {
//     console.log('Error: -> ', error);
//   });
//# sourceMappingURL=redirectToProduct.js.map