Skip to content

Commit 3337400

Browse files
author
Victor Lopez
committed
chore: Remove yarn.lock file and update error handling with optional chaining in Sentry and header component
1 parent 0faa712 commit 3337400

File tree

5 files changed

+16
-13059
lines changed

5 files changed

+16
-13059
lines changed

src/app/core/sentry-error-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export class SentryErrorHandler implements ErrorHandler {
1313
this.sentryService.captureException(error, {
1414
type: 'unhandled_error',
1515
timestamp: new Date().toISOString(),
16-
location: window.location.href,
17-
userAgent: navigator.userAgent,
16+
location: window?.location?.href,
17+
userAgent: navigator?.userAgent,
1818
});
1919
}
2020
}

src/app/pcdc-header/pcdc-header.component.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,42 @@ import { SettingsService } from '../services/settings.service';
99
styleUrls: ['./pcdc-header.component.scss'],
1010
})
1111
export class PcdcHeaderComponent implements OnInit {
12-
languages = env.languages;
12+
languages = env?.languages ?? [];
1313
selectedLanguage: string;
1414
selectedLanguageName: string;
1515
test = false;
16-
appName = env.appName;
17-
appNameSuffix = env.appNameSuffix;
16+
appName = env?.appName ?? '';
17+
appNameSuffix = env?.appNameSuffix ?? '';
1818
constructor(
1919
private translate: TranslateService,
2020
private settingsService: SettingsService
2121
) {
2222
// Retrieve the selected language from local storage if it exists
2323
this.selectedLanguage =
24-
this.settingsService.get('applicationLanguage')?.code ||
24+
this.settingsService.get('applicationLanguage')?.code ??
2525
translate.defaultLang;
2626
this.selectedLanguageName = this.languages.find(
27-
(l) => l.code === this.selectedLanguage
28-
).name;
27+
(l) => l?.code === this.selectedLanguage
28+
)?.name ?? '';
2929
translate.use(this.selectedLanguage);
30-
this.test = env.mode === 'dev';
30+
this.test = env?.mode === 'dev';
3131
}
3232
ngOnInit() { }
3333
onLanguageChange() {
3434
// Update local storage when the language changes
3535
this.settingsService.setSetting(
3636
'applicationLanguage',
37-
this.languages.find((l) => l.code === this.selectedLanguage)
37+
this.languages.find((l) => l?.code === this.selectedLanguage)
3838
);
3939
this.selectedLanguageName = this.languages.find(
40-
(l) => l.code === this.selectedLanguage
41-
).name;
40+
(l) => l?.code === this.selectedLanguage
41+
)?.name ?? '';
4242
window.location.reload();
4343
}
4444
closeApp() {
4545
this.settingsService
4646
.getIpcRenderer()
47-
.ipcRenderer.send('closeFromUi', 'minimize');
47+
?.ipcRenderer
48+
?.send('closeFromUi', 'minimize');
4849
}
4950
}

src/environments/environment.prod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export const environment = {
44
restAPI: 'https://uni-connect-services.azurewebsites.net/api/v1/',
55
//restAPI: 'http://localhost:3000/api/v1/',
66
token: env.token,
7-
app_version: '1.0.11',
7+
app_version: '2.0.0',
88
};

src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const environment = {
88
// restAPI: 'https://uni-connect-services.azurewebsites.net/api/v1/',
99
restAPI: env.mode === 'dev' ? env.restAPIDev : env.restAPI,
1010
token: env.mode === 'dev' ? env.tokenDev : token,
11-
app_version: '1.0.11',
11+
app_version: '2.0.0',
1212
appName: 'Giga Meter',
1313
appNameSuffix: '',
1414
showAboutMenu: true,

0 commit comments

Comments
 (0)