chore: standardize dev-only debug logging across all three SPAs
Router guards: - apps/app: added DEV-gated logging matching admin pattern (route info, auth decisions, org selection, access granted/denied) - apps/portal: added DEV-gated logging matching admin pattern (route info, auth decisions, backward-compat redirects) - apps/admin: already had full logging (unchanged) Ungated console statements fixed: - admin/main.ts: error handler, plugin registration, mount errors - admin/pages/login.vue, register.vue: catch block errors - admin/pages/events/index.vue: fetch error logging - admin/pages/wizard-examples: demo form submit logging - admin/pages/faq.vue: catch block error All console statements in Crewli-authored code are now gated behind import.meta.env.DEV — zero console output in production builds. Vuexy template demo files (views/demos/*) left as-is. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,8 +14,10 @@ const app = createApp(App)
|
||||
|
||||
// Error handler for unhandled errors
|
||||
app.config.errorHandler = (err, instance, info) => {
|
||||
console.error('Vue Error:', err, info)
|
||||
console.error('Component:', instance)
|
||||
if (import.meta.env.DEV) {
|
||||
console.error('Vue Error:', err, info)
|
||||
console.error('Component:', instance)
|
||||
}
|
||||
}
|
||||
|
||||
// Register plugins
|
||||
@@ -24,7 +26,7 @@ app.use(VueQueryPlugin, queryClientConfig)
|
||||
try {
|
||||
registerPlugins(app)
|
||||
} catch (error) {
|
||||
console.error('Failed to register plugins:', error)
|
||||
if (import.meta.env.DEV) console.error('Failed to register plugins:', error)
|
||||
throw error
|
||||
}
|
||||
|
||||
@@ -32,7 +34,7 @@ try {
|
||||
try {
|
||||
app.mount('#app')
|
||||
} catch (error) {
|
||||
console.error('Failed to mount app:', error)
|
||||
if (import.meta.env.DEV) console.error('Failed to mount app:', error)
|
||||
// Show error message to user (safe DOM construction — no innerHTML with variables)
|
||||
const el = document.getElementById('app')!
|
||||
el.innerHTML = ''
|
||||
|
||||
@@ -31,7 +31,7 @@ watch([page, itemsPerPage], async () => {
|
||||
})
|
||||
}
|
||||
catch (err) {
|
||||
console.error('Failed to fetch events:', err)
|
||||
if (import.meta.env.DEV) console.error('Failed to fetch events:', err)
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
@@ -44,7 +44,7 @@ watch(organisationId, async (id) => {
|
||||
})
|
||||
}
|
||||
catch (err) {
|
||||
console.error('Failed to fetch events:', err)
|
||||
if (import.meta.env.DEV) console.error('Failed to fetch events:', err)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -96,7 +96,7 @@ const login = async () => {
|
||||
router.replace(rawTo.startsWith('/') ? rawTo : '/')
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err)
|
||||
if (import.meta.env.DEV) console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ const fetchFaqs = async () => {
|
||||
query: {
|
||||
q: faqSearchQuery.value,
|
||||
},
|
||||
}).catch(err => console.log(err))
|
||||
}).catch(err => { if (import.meta.env.DEV) console.log(err) })
|
||||
|
||||
faqs.value = data
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ const register = async () => {
|
||||
})
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err)
|
||||
if (import.meta.env.DEV) console.error(err)
|
||||
}
|
||||
finally {
|
||||
isLoading.value = false
|
||||
|
||||
@@ -65,7 +65,7 @@ const createDealData = ref<CreateDealData>({
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
console.log('createDealData :>> ', createDealData.value)
|
||||
if (import.meta.env.DEV) console.log('createDealData :>> ', createDealData.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ const propertyListingData = ref<PropertyListingData>({
|
||||
const currentStep = ref(0)
|
||||
|
||||
const onSubmit = () => {
|
||||
console.log('propertyListingData :>> ', propertyListingData.value)
|
||||
if (import.meta.env.DEV) console.log('propertyListingData :>> ', propertyListingData.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user