fix: use centralized logger in onboarding.js
Replace console.log/error calls with onboardingLog in handleLogout function to comply with architecture rules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
10
static/vendor/js/onboarding.js
vendored
10
static/vendor/js/onboarding.js
vendored
@@ -605,7 +605,7 @@ function vendorOnboarding(initialLang = 'en') {
|
|||||||
|
|
||||||
// Logout handler
|
// Logout handler
|
||||||
async handleLogout() {
|
async handleLogout() {
|
||||||
console.log('🚪 Logging out from onboarding...');
|
onboardingLog.info('Logging out from onboarding...');
|
||||||
|
|
||||||
// Get vendor code from URL
|
// Get vendor code from URL
|
||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
@@ -615,19 +615,19 @@ function vendorOnboarding(initialLang = 'en') {
|
|||||||
try {
|
try {
|
||||||
// Call logout API
|
// Call logout API
|
||||||
await apiClient.post('/vendor/auth/logout');
|
await apiClient.post('/vendor/auth/logout');
|
||||||
console.log('✅ Logout API called successfully');
|
onboardingLog.info('Logout API called successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('⚠️ Logout API error (continuing anyway):', error);
|
onboardingLog.warn('Logout API error (continuing anyway):', error);
|
||||||
} finally {
|
} finally {
|
||||||
// Clear vendor tokens only (not admin or customer tokens)
|
// Clear vendor tokens only (not admin or customer tokens)
|
||||||
console.log('🧹 Clearing vendor tokens...');
|
onboardingLog.info('Clearing vendor tokens...');
|
||||||
localStorage.removeItem('vendor_token');
|
localStorage.removeItem('vendor_token');
|
||||||
localStorage.removeItem('vendor_user');
|
localStorage.removeItem('vendor_user');
|
||||||
localStorage.removeItem('currentUser');
|
localStorage.removeItem('currentUser');
|
||||||
localStorage.removeItem('vendorCode');
|
localStorage.removeItem('vendorCode');
|
||||||
// Note: Do NOT use localStorage.clear() - it would clear admin/customer tokens too
|
// Note: Do NOT use localStorage.clear() - it would clear admin/customer tokens too
|
||||||
|
|
||||||
console.log('🔄 Redirecting to login...');
|
onboardingLog.info('Redirecting to login...');
|
||||||
window.location.href = `/vendor/${vendorCode}/login`;
|
window.location.href = `/vendor/${vendorCode}/login`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user