mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-12 00:23:08 -04:00
webui: splitting rs() into rs() and rs.request()
This commit is contained in:
parent
03e2a18be1
commit
62ee95e706
2 changed files with 37 additions and 14 deletions
|
@ -9,10 +9,12 @@ var accountMap = new Map();
|
||||||
|
|
||||||
function login(){
|
function login(){
|
||||||
//alert("login:" + curraccount.location + "; passwort: " + currentpasswd);
|
//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");
|
//alert("login send");
|
||||||
rs("control/password",{data: {password: currentpasswd}});
|
rs.request("control/password", {password: currentpasswd}, function(){
|
||||||
}});
|
m.redraw();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel(){
|
function cancel(){
|
||||||
|
|
|
@ -130,17 +130,23 @@ function schedule_request_missing(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function rs(path, optionen){
|
function rs(path, args, callback){
|
||||||
if(optionen === undefined) {
|
if(cache[path] === undefined){
|
||||||
if(cache[path] === undefined){
|
cache[path] = {
|
||||||
cache[path] = {
|
data: args,
|
||||||
data: undefined,
|
statetoken: undefined,
|
||||||
statetoken: undefined,
|
requested: false,
|
||||||
requested: false,
|
then: function(){
|
||||||
};
|
if (callback != undefined) {
|
||||||
schedule_request_missing();
|
callback();
|
||||||
}
|
}
|
||||||
return cache[path].data;
|
}
|
||||||
|
};
|
||||||
|
schedule_request_missing();
|
||||||
|
}
|
||||||
|
return cache[path].data;
|
||||||
|
}
|
||||||
|
/*
|
||||||
} else{
|
} else{
|
||||||
m.request({
|
m.request({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -157,5 +163,20 @@ function rs(path, optionen){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
module.exports = rs;
|
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…
Add table
Add a link
Reference in a new issue