Remove all bid URL params - use localStorage exclusively for business selection
This commit is contained in:
parent
96e598c6af
commit
4e4f3cf465
5 changed files with 14 additions and 19 deletions
|
|
@ -264,8 +264,9 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
async verifyAndRedirect(token, businessId) {
|
async verifyAndRedirect(token, businessId) {
|
||||||
// For now, just redirect - could add token verification
|
// Save business ID to localStorage and redirect
|
||||||
window.location.href = BASE_PATH + `/portal/index.html?bid=${businessId}`;
|
localStorage.setItem('payfrit_portal_business', businessId);
|
||||||
|
window.location.href = BASE_PATH + '/portal/index.html';
|
||||||
},
|
},
|
||||||
|
|
||||||
async login() {
|
async login() {
|
||||||
|
|
@ -413,7 +414,7 @@
|
||||||
|
|
||||||
selectBusinessById(businessId) {
|
selectBusinessById(businessId) {
|
||||||
localStorage.setItem('payfrit_portal_business', 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() {
|
startNewRestaurant() {
|
||||||
|
|
|
||||||
|
|
@ -1048,9 +1048,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get business ID from URL or saved
|
// Get business ID from localStorage
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
this.config.businessId = parseInt(savedBusiness) || null;
|
||||||
this.config.businessId = parseInt(urlParams.get('bid')) || parseInt(savedBusiness);
|
|
||||||
this.config.token = token;
|
this.config.token = token;
|
||||||
|
|
||||||
// Load business info
|
// Load business info
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,8 @@ const Portal = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use saved business ID, but allow URL override
|
// Use saved business ID from localStorage
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
this.config.businessId = parseInt(savedBusiness) || null;
|
||||||
this.config.businessId = parseInt(urlParams.get('bid')) || parseInt(savedBusiness);
|
|
||||||
this.config.userId = parseInt(userId) || 1;
|
this.config.userId = parseInt(userId) || 1;
|
||||||
this.config.token = token;
|
this.config.token = token;
|
||||||
|
|
||||||
|
|
@ -409,7 +408,7 @@ const Portal = {
|
||||||
</div>
|
</div>
|
||||||
<h3>Visual Menu Builder</h3>
|
<h3>Visual Menu Builder</h3>
|
||||||
<p>Drag-and-drop interface to build menus. Clone items, add modifiers, create photo tasks.</p>
|
<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
|
Open Builder
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -422,7 +421,7 @@ const Portal = {
|
||||||
</div>
|
</div>
|
||||||
<h3>Station Assignment</h3>
|
<h3>Station Assignment</h3>
|
||||||
<p>Drag items to stations (Grill, Fry, Drinks, etc.) for KDS routing.</p>
|
<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
|
Assign Stations
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -974,11 +974,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
function initializeConfig() {
|
function initializeConfig() {
|
||||||
// Get business ID from URL only - don't use localStorage for wizard
|
// Wizard is for creating NEW businesses - businessId starts as null
|
||||||
// The wizard is for creating NEW businesses, so we shouldn't default to an existing one
|
config.businessId = null;
|
||||||
// Only use bid from URL if explicitly editing an existing business
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
|
||||||
config.businessId = urlParams.get('bid') || null;
|
|
||||||
|
|
||||||
// Determine API base URL
|
// Determine API base URL
|
||||||
const basePath = window.location.pathname.includes('/biz.payfrit.com/')
|
const basePath = window.location.pathname.includes('/biz.payfrit.com/')
|
||||||
|
|
@ -2031,7 +2028,7 @@
|
||||||
|
|
||||||
// Redirect to visual menu builder after a moment
|
// Redirect to visual menu builder after a moment
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = `index.html?bid=${finalBusinessId}#menu`;
|
window.location.href = 'index.html#menu';
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -441,8 +441,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
this.config.businessId = parseInt(savedBusiness) || null;
|
||||||
this.config.businessId = parseInt(urlParams.get('bid')) || parseInt(savedBusiness);
|
|
||||||
this.config.token = token;
|
this.config.token = token;
|
||||||
|
|
||||||
await this.loadBusinessInfo();
|
await this.loadBusinessInfo();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue