From e1972d50fc15abb6e4d24bb9f4f85035fa1bc489 Mon Sep 17 00:00:00 2001 From: drecodeam Date: Sat, 1 Sep 2018 00:30:51 +0530 Subject: [PATCH] fix file not found error --- src/app/components/home/home.component.scss | 3 +++ src/app/components/home/home.component.ts | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/components/home/home.component.scss b/src/app/components/home/home.component.scss index 3448777..1582300 100644 --- a/src/app/components/home/home.component.scss +++ b/src/app/components/home/home.component.scss @@ -73,7 +73,10 @@ $haiti : #170139; overflow: hidden; font-family: $font-sans-serif; color: $pelorous; + color: white; background: transparent; + background: linear-gradient(270deg, darken( #F97C24, 10% ), darken( #D9497D, 10%)); + .message { font-weight: 400; display: inline-block; diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts index a5e652d..b2e8cbb 100644 --- a/src/app/components/home/home.component.ts +++ b/src/app/components/home/home.component.ts @@ -24,7 +24,7 @@ export class HomeComponent implements OnInit, AfterViewInit { } // COMMONLY USED ELECTRON SERVICE REFERENCES - filePath = this.electronService.remote.app.getPath('appData') + '/list.json'; + filePath = this.electronService.remote.app.getPath('appData') + '/list2.json'; fs = this.electronService.fs; app = this.electronService.remote.app; window = this.electronService.remote.getCurrentWindow(); @@ -220,6 +220,10 @@ export class HomeComponent implements OnInit, AfterViewInit { getCurrentList() { try { this.data = JSON.parse(this.fs.readFileSync(this.filePath).toString()); + return this.data; + } catch (error) { + // if there was some kind of error, return the passed in defaults instead. + console.log('there seems to be an issue getting the current data'); if (!this.data) { this.data = { hideOnboarding: false, @@ -228,10 +232,6 @@ export class HomeComponent implements OnInit, AfterViewInit { this.fs.writeFileSync(this.filePath, this.data, 'utf-8'); } return this.data; - } catch (error) { - // if there was some kind of error, return the passed in defaults instead. - console.log('there seems to be an issue getting the current data'); - return false; } } @@ -458,7 +458,8 @@ export class HomeComponent implements OnInit, AfterViewInit { } ngOnInit() { - this.getCurrentList(); + const data = this.getCurrentList(); + console.log( 'data is' + data ); this.sanitizeData(); this.updateData(); }