gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[reclaim-ui] 372/459: fix defaults loading


From: gnunet
Subject: [reclaim-ui] 372/459: fix defaults loading
Date: Fri, 11 Jun 2021 23:27:44 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository reclaim-ui.

commit 50d65b59679175e16ac992fd4350fd8d569c095b
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Dec 25 19:01:46 2020 +0900

    fix defaults loading
---
 src/app/config.service.ts | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/app/config.service.ts b/src/app/config.service.ts
index 03dabdb..b08b9a8 100644
--- a/src/app/config.service.ts
+++ b/src/app/config.service.ts
@@ -12,16 +12,24 @@ export class ConfigService {
     var confString = localStorage.getItem('reclaimSettings');
     try {
       this.config = JSON.parse(confString);
-      console.log("Loaded settings: " + confString);
+      if (this.config == null) {
+        this.loadDefaults();
+      } else {
+        console.log("Loaded settings: " + confString);
+      }
     } catch(e) {
-      this.http.get<Config>('assets/config.json').subscribe(cnf => {
-        this.config = cnf;
-        console.log("Got default settings: " + cnf);
-      });
+      this.loadDefaults();
       console.log("Error loading settings: " + e);
     }
   }
 
+  loadDefaults() {
+    this.http.get<Config>('assets/config.json').subscribe(cnf => {
+      this.config = cnf;
+      console.log("Got default settings: " + cnf);
+    });
+  }
+
   get(): Config {
     return this.config;
   }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]