URL Navigation Action/Link tag

URL Navigation Action/Link tag

quincyo
Shopify Partner
3 0 0

I'm building a shopify extension block app, refer to a code snipped below, I'm trying to open up the link that is the value of redirectUrl, I've followed the documentation here https://shopify.dev/docs/api/app-bridge/previous-versions/actions/navigation, neither of the techniques worked, I have also tried using a link tag, the link tag also has no functionality and doesn't lead me to the link provided. Please help me with this. 

 

const buyRate = useCallback(async (rateID, shipmentID) => {
try{
 
console.log(shipmentID);
const res = await fetch(`/api/buyrate?shipmentID=${shipmentID}&rateID=${rateID}`, {
method: 'POST'
});

if (!res.ok) {
throw new Error(`Network response was not ok: ${res.statusText}`);
}

const result = await res.json();
console.log('Parsed JSON:', result);
//console.log(result.postageLabel.labelUrl);

setRedirectUrl(result.postageLabel.labelUrl);
// open redirectUrl in another browser window

} catch (error) {
console.error("Error fetching data:", error);
setError(error.message);
}

}, []);
Replies 0 (0)