@adilei
const [directLineURL, token] = await Promise.all([
fetch(new URL(`/powervirtualagents/regionalchannelsettings?api-version=${apiVersion}`, tokenEndpointURL))We have tried as below to use the fetch new URL part as per your code snippet shared above.
useEffect(() => {
const fetchDirectLineToken = async () => {
try {
const response = await fetch(new URL(`/powervirtualagents/regionalchannelsettings?api-version=2022-03-01-preview`, endPOINTURL));
if (!response.ok) {
throw new Error('Failed to retrieve DirectLine token.');
}
const { token } = await response.json();
setDirectLineToken(token);
console.log("tokenprint",token)
} catch (error) {
console.error('Error fetching Direct Line token:', error);
}
};
fetchDirectLineToken();
}, []);
has context menu
But we are getting the tokenprint console.log value as undefined. What are we missing? How does new URL() connects to PVA to get the token from our custom website?