Skip to content

Commit

Permalink
Merge pull request #55 from WWWPiramalFinanceCOM/branch-loc-06-12-24
Browse files Browse the repository at this point in the history
branch locator issue fixed
  • Loading branch information
omprakashgupta1995 authored Dec 6, 2024
2 parents d07ac6b + e9ac080 commit 3d6fc71
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions blocks/branchlocator/branchlocator-biz.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,19 @@ function setDefaultLocation() {
}
}

function updateURL() {
async function updateURL() {
const { geoInfo } = setLocationObj;
const URLstate = formatURLString(geoInfo.state);
const URLcity = formatURLString(geoInfo.city);

if (!location.href.includes("author") && !location.href.includes(URLstate)) {
location.href =
geoInfo.state && geoInfo.city ? branchURLStr(geoInfo.location, geoInfo.city, geoInfo.state, "shorthand") : branchURLStr(geoInfo.location, geoInfo.city, geoInfo.state, "shorthandstate");
var branchUrl = geoInfo.state && geoInfo.city ? branchURLStr(geoInfo.location, geoInfo.city, geoInfo.state, "shorthand") : branchURLStr(geoInfo.location, geoInfo.city, geoInfo.state, "shorthandstate");
const resp = await fetch(branchUrl);
if (resp.ok) {
location.href = branchUrl
} else {
location.href = '/branch-locator/maharashtra/mumbai';
}
}
}

Expand Down

0 comments on commit 3d6fc71

Please sign in to comment.