mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-04 17:15:31 -05:00
webui: splitting rs() into rs() and rs.request()
This commit is contained in:
parent
03e2a18be1
commit
62ee95e706
@ -9,10 +9,12 @@ var accountMap = new Map();
|
||||
|
||||
function login(){
|
||||
//alert("login:" + curraccount.location + "; passwort: " + currentpasswd);
|
||||
rs("control/login", {data: {id: curraccount.id}, callback:function(){
|
||||
rs.request("control/login", {id: curraccount.id}, function(){
|
||||
//alert("login send");
|
||||
rs("control/password",{data: {password: currentpasswd}});
|
||||
}});
|
||||
rs.request("control/password", {password: currentpasswd}, function(){
|
||||
m.redraw();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function cancel(){
|
||||
|
@ -130,17 +130,23 @@ function schedule_request_missing(){
|
||||
});
|
||||
}
|
||||
|
||||
function rs(path, optionen){
|
||||
if(optionen === undefined) {
|
||||
if(cache[path] === undefined){
|
||||
cache[path] = {
|
||||
data: undefined,
|
||||
statetoken: undefined,
|
||||
requested: false,
|
||||
};
|
||||
schedule_request_missing();
|
||||
}
|
||||
return cache[path].data;
|
||||
function rs(path, args, callback){
|
||||
if(cache[path] === undefined){
|
||||
cache[path] = {
|
||||
data: args,
|
||||
statetoken: undefined,
|
||||
requested: false,
|
||||
then: function(){
|
||||
if (callback != undefined) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
schedule_request_missing();
|
||||
}
|
||||
return cache[path].data;
|
||||
}
|
||||
/*
|
||||
} else{
|
||||
m.request({
|
||||
method: "POST",
|
||||
@ -157,5 +163,20 @@ function rs(path, optionen){
|
||||
});
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
module.exports = rs;
|
||||
|
||||
rs.request=function(path, args, callback){
|
||||
m.request({
|
||||
method: "POST",
|
||||
url: api_url + path,
|
||||
data: args,
|
||||
background: true
|
||||
}).then(function(response){
|
||||
if (callback != undefined) {
|
||||
callback(response.data, response.statetoken);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user