Skip to content

Commit f300194

Browse files
committed
- DEVSU-2192 Change serverName code logic from nested ternary to switch case
1 parent f1e9217 commit f300194

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

app/views/PrintView/index.tsx

+13-5
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,21 @@ const Print = ({
174174
const hours = currentDate.getHours().toString().padStart(2, '0');
175175
const minutes = currentDate.getMinutes().toString().padStart(2, '0');
176176
const seconds = currentDate.getSeconds().toString().padStart(2, '0');
177-
// const serverName = process.env.NODE_ENV === 'production' ? '' : process.env.NODE_ENV === 'development' ? '_iprdev' : '_iprstaging';
178-
177+
let serverName;
178+
switch (process.env.NODE_ENV) {
179+
case 'production':
180+
serverName = '';
181+
break;
182+
case 'development':
183+
serverName = '_iprdev';
184+
break;
185+
default:
186+
serverName = '_iprstaging';
187+
break;
188+
}
179189
const formattedDate = `${year}-${month}-${day}_${hours}h${minutes}m${seconds}s`;
180190

181-
// document.title = `${report.patientId}${serverName}_${report.template.name}_report_${formattedDate}`;
182-
document.title = `${report.patientId}_${templateName}_report_${formattedDate}`;
183-
191+
document.title = `${report.patientId}${serverName}_${templateName}_report_${formattedDate}`;
184192
window.print();
185193
setIsPrintDialogShown(true);
186194
};

0 commit comments

Comments
 (0)