Remove all bid URL params - use localStorage exclusively for business selection

This commit is contained in:
John Mizerek 2026-01-18 13:18:10 -08:00
parent 96e598c6af
commit 4e4f3cf465
5 changed files with 14 additions and 19 deletions

View file

@ -264,8 +264,9 @@
},
async verifyAndRedirect(token, businessId) {
// For now, just redirect - could add token verification
window.location.href = BASE_PATH + `/portal/index.html?bid=${businessId}`;
// Save business ID to localStorage and redirect
localStorage.setItem('payfrit_portal_business', businessId);
window.location.href = BASE_PATH + '/portal/index.html';
},
async login() {
@ -413,7 +414,7 @@
selectBusinessById(businessId) {
localStorage.setItem('payfrit_portal_business', businessId);
window.location.href = BASE_PATH + `/portal/index.html?bid=${businessId}`;
window.location.href = BASE_PATH + '/portal/index.html';
},
startNewRestaurant() {

View file

@ -1048,9 +1048,8 @@
return;
}
// Get business ID from URL or saved
const urlParams = new URLSearchParams(window.location.search);
this.config.businessId = parseInt(urlParams.get('bid')) || parseInt(savedBusiness);
// Get business ID from localStorage
this.config.businessId = parseInt(savedBusiness) || null;
this.config.token = token;
// Load business info

View file

@ -65,9 +65,8 @@ const Portal = {
return;
}
// Use saved business ID, but allow URL override
const urlParams = new URLSearchParams(window.location.search);
this.config.businessId = parseInt(urlParams.get('bid')) || parseInt(savedBusiness);
// Use saved business ID from localStorage
this.config.businessId = parseInt(savedBusiness) || null;
this.config.userId = parseInt(userId) || 1;
this.config.token = token;
@ -409,7 +408,7 @@ const Portal = {
</div>
<h3>Visual Menu Builder</h3>
<p>Drag-and-drop interface to build menus. Clone items, add modifiers, create photo tasks.</p>
<a href="${BASE_PATH}/portal/menu-builder.html?bid=${this.config.businessId}" class="btn btn-primary btn-lg">
<a href="${BASE_PATH}/portal/menu-builder.html" class="btn btn-primary btn-lg">
Open Builder
</a>
</div>
@ -422,7 +421,7 @@ const Portal = {
</div>
<h3>Station Assignment</h3>
<p>Drag items to stations (Grill, Fry, Drinks, etc.) for KDS routing.</p>
<a href="/portal/station-assignment.html?bid=${this.config.businessId}" class="btn btn-secondary btn-lg">
<a href="/portal/station-assignment.html" class="btn btn-secondary btn-lg">
Assign Stations
</a>
</div>

View file

@ -974,11 +974,8 @@
});
function initializeConfig() {
// Get business ID from URL only - don't use localStorage for wizard
// The wizard is for creating NEW businesses, so we shouldn't default to an existing one
// Only use bid from URL if explicitly editing an existing business
const urlParams = new URLSearchParams(window.location.search);
config.businessId = urlParams.get('bid') || null;
// Wizard is for creating NEW businesses - businessId starts as null
config.businessId = null;
// Determine API base URL
const basePath = window.location.pathname.includes('/biz.payfrit.com/')
@ -2031,7 +2028,7 @@
// Redirect to visual menu builder after a moment
setTimeout(() => {
window.location.href = `index.html?bid=${finalBusinessId}#menu`;
window.location.href = 'index.html#menu';
}, 1500);
} catch (error) {

View file

@ -441,8 +441,7 @@
return;
}
const urlParams = new URLSearchParams(window.location.search);
this.config.businessId = parseInt(urlParams.get('bid')) || parseInt(savedBusiness);
this.config.businessId = parseInt(savedBusiness) || null;
this.config.token = token;
await this.loadBusinessInfo();