Skip to content

Commit d62dd8a

Browse files
committed
Removed unecessary conditional statement. Added comments.
1 parent 1e5b70f commit d62dd8a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/components/AddService.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@ import ServicesDashboard from './ServicesDashboard.jsx';
66
const { ipcRenderer } = window.require('electron');
77

88
const AddService = () => {
9+
// Context used to ensure that that this page is only seen when the setup is required. Updated when user adds a database.
910
const ChronosSetup = useContext(SetupContext);
11+
// Local state created for form entries ONLY.
1012
const [dbState, setDbType] = useState('SQL');
1113
const [uriState, setUri] = useState('');
1214
const [labelState, setLabel] = useState('');
1315

16+
// Submits data provided by the user to added to the setting file.
1417
const onSubmit = () => {
1518
const userSettings = [labelState, dbState, uriState];
1619
// IPC communication used to update settings JSON with user input.
1720
ipcRenderer.send('submit', JSON.stringify(userSettings));
1821
ChronosSetup.setupRequired = ChronosSetup.toggleSetup(true);
22+
// Refresh window after submit.
1923
document.location.reload();
2024
};
2125

22-
if (!ChronosSetup.setupRequired) return React.lazy(<ServicesDashboard />);
23-
2426
return (
2527
<div className="mainContainer">
2628
<img src={logo} alt="logo" />
@@ -49,6 +51,7 @@ const AddService = () => {
4951
<button
5052
className="submitBtn"
5153
type="submit"
54+
// Error Handling.
5255
onClick={() => {
5356
if (
5457
document.getElementById('dburi').value === ''

0 commit comments

Comments
 (0)