Skip to content

Commit

Permalink
PWA#3093 Url Rewrite to external URL does not work on PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
RaghavendraTirumalasetti committed Apr 27, 2023
1 parent 32307d4 commit 7d99f87
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/peregrine/lib/talons/MagentoRoute/useMagentoRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ export const useMagentoRoute = (props = {}) => {
const { data, error, loading } = queryResult;
const { route } = data || {};

// redirect to external url
useEffect(() => {
if (route) {
const external_URL = route.relative_url;
if (external_URL && external_URL.startsWith('http')) {
window.location.replace(external_URL);
}
}
}, [route]);

useEffect(() => {
if (initialized.current || !getInlinedPageData()) {
runQuery({
Expand Down

0 comments on commit 7d99f87

Please sign in to comment.