]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blobdiff - frontend/js/app.js
Fixup the config file usage
[perso/Immae/Projets/Nodejs/Surfer.git] / frontend / js / app.js
index 57b831eeca698423a3e25bafcde72900fdf0d87c..6303a892984868c4d496b92efe04c556033e0028 100644 (file)
@@ -35,7 +35,13 @@ function getProfile(accessToken, callback) {
         app.session.username = result.body.username;
         app.session.valid = true;
 
-        callback();
+        superagent.get('/api/settings').query({ access_token: localStorage.accessToken }).end(function (error, result) {
+            if (error) console.error(error);
+
+            app.folderListingEnabled = !!result.body.folderListingEnabled;
+
+            callback();
+        });
     });
 }
 
@@ -211,7 +217,9 @@ var app = new Vue({
         },
         onOptionsMenu: function (command) {
             if (command === 'folderListing') {
-                console.log('Not implemented');
+                superagent.put('/api/settings').send({ folderListingEnabled: this.folderListingEnabled }).query({ access_token: localStorage.accessToken }).end(function (error) {
+                    if (error) console.error(error);
+                });
             } else if (command === 'about') {
                 this.$msgbox({
                     title: 'About Surfer',