update local.api

This commit is contained in:
j 2010-09-27 10:15:25 +02:00
parent 90fc92d259
commit 93d2a77f3d

View file

@ -9,6 +9,9 @@ app.afterLaunch.push(function() {
api: new OxFF(), api: new OxFF(),
volumes: function(cb) { volumes: function(cb) {
var _this = this; var _this = this;
Ox.print('api.volumes');
this.api.login(window, app.user.username);
Ox.print('api.now access');
this.api.access(function(access) { this.api.access(function(access) {
Ox.print('access callback', access); Ox.print('access callback', access);
if(!access) { if(!access) {
@ -33,7 +36,6 @@ app.afterLaunch.push(function() {
.append("For this part of the page to work, you have to allow OxFF to send data to this site") .append("For this part of the page to work, you have to allow OxFF to send data to this site")
.open(); .open();
} else { } else {
_this.api.login(app.user.username);
_this.api.volumes(function(result) { _this.api.volumes(function(result) {
var data = JSON.parse(result); var data = JSON.parse(result);
cb(data); cb(data);
@ -42,9 +44,9 @@ app.afterLaunch.push(function() {
}); });
}, },
files: function(archive, cb) { files: function(archive, cb) {
this.api.login(window, app.user.username);
if(!this.api.access()) if(!this.api.access())
return false; return false;
this.api.login(app.user.username);
this.api.files(archive, function(result) { this.api.files(archive, function(result) {
var data = JSON.parse(result); var data = JSON.parse(result);
cb(data); cb(data);