updates on the api integration and the design changes on the whole website
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
"ordersummary": "Orders Summary",
|
||||
"ordersdetails": "Orders Details",
|
||||
"riderssummary": "Riders Summary",
|
||||
"profitability": "Profitability",
|
||||
"dispatch": "Dispatch",
|
||||
"customers": "Customers",
|
||||
"fleetops": "Fleet & Ops",
|
||||
|
||||
@@ -15,11 +15,6 @@ const style = (bg, color) => `background: ${bg}; color: ${color}; padding: 2px 5
|
||||
const PREFIX = '%c[Doormile Express]';
|
||||
const PREFIX_STYLE = style('#2563eb', '#ffffff');
|
||||
|
||||
// Capture original console methods before any global overrides occur
|
||||
const originalLog = console.log;
|
||||
const originalWarn = console.warn || console.log;
|
||||
const originalError = console.error || console.log;
|
||||
|
||||
const print = (levelName, args, labelStyle) => {
|
||||
const levelValue = LOG_LEVELS[levelName];
|
||||
if (levelValue < GLOBAL_LOG_LEVEL) return;
|
||||
@@ -30,10 +25,17 @@ const print = (levelName, args, labelStyle) => {
|
||||
const formatPrefix = `${PREFIX}%c ${levelName}`;
|
||||
const styles = [PREFIX_STYLE, labelStyle];
|
||||
|
||||
// Read console.log/warn/error fresh on every call rather than capturing
|
||||
// them at module-import time — index.js's production console-disable
|
||||
// override (console.log = () => {}, etc.) runs as part of its own
|
||||
// top-level code, which executes AFTER this module's imports are
|
||||
// evaluated. Capturing eagerly grabbed the real methods before that
|
||||
// override existed, so logger.warn/error silently bypassed the prod
|
||||
// safety net and kept printing to the browser console.
|
||||
const consoleMethod =
|
||||
levelName === 'ERROR' ? originalError :
|
||||
levelName === 'WARN' ? originalWarn :
|
||||
originalLog;
|
||||
levelName === 'ERROR' ? console.error || console.log :
|
||||
levelName === 'WARN' ? console.warn || console.log :
|
||||
console.log;
|
||||
|
||||
if (isMessageString) {
|
||||
consoleMethod(
|
||||
|
||||
Reference in New Issue
Block a user