updates on the fix
This commit is contained in:
@@ -75,13 +75,15 @@ const Createcustomer = () => {
|
||||
});
|
||||
|
||||
// LocationAutocomplete only reports back applocationid/locationname — it
|
||||
// caches the full hub list (with lat/lng) in localStorage('applocations')
|
||||
// caches the full hub list (with lat/lng) in localStorage under a
|
||||
// tenant-scoped key (applocations_<tenantid>, see LocationAutocomplete.js)
|
||||
// as a side effect, so pull the coordinates for the address-search bias
|
||||
// from there rather than duplicating the GET /admin/hubs call.
|
||||
useEffect(() => {
|
||||
if (!appId) return;
|
||||
try {
|
||||
const hubs = JSON.parse(localStorage.getItem('applocations') || '[]');
|
||||
const applocationsCacheKey = `applocations_${localStorage.getItem('tenantid') || 'staff'}`;
|
||||
const hubs = JSON.parse(localStorage.getItem(applocationsCacheKey) || '[]');
|
||||
const hub = hubs.find((h) => h.applocationid === appId);
|
||||
if (hub?.latitude) {
|
||||
setAppLocaLat(hub.latitude);
|
||||
|
||||
Reference in New Issue
Block a user