Make changes

This commit is contained in:
2019-09-15 10:55:06 +05:30
parent f43e2cb533
commit f3842d3901

View File

@@ -2,13 +2,27 @@
let currDir = {'loc':'','contents':null} let currDir = {'loc':'','contents':null}
let currSel = {'loc':null,'name':null} let currSel = {'loc':null,'name':null}
function makeLSRequest(location){
return {
loc: location
}
}
function makeMVRequest(location,newLocation){
return {
loc: location,
nloc: newLocation
}
}
///Get Path at location ///Get Path at location
async function postLS(inputPath){ async function postLS(inputPath){
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
$.ajax('/files/ls',{ $.ajax('/files/ls',{
method:'post', method:'post',
data:{loc:inputPath}, data: makeLSRequest(inputPath),
success:(msg)=>{ success:(msg)=>{
resolve(msg); resolve(msg);
}, },
@@ -25,10 +39,7 @@ async function postMV(oldLocation,newLocation){
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
$.ajax({ $.ajax({
method:"post", method:"post",
data:{ data: makeMVRequest(oldLocation,newLocation),
"loc":oldLocation,
"nloc":newLocation
},
success:response=>{ success:response=>{
resolve(response) resolve(response)
}, },
@@ -42,7 +53,6 @@ async function postMV(oldLocation,newLocation){
///Call for onclick of elements ///Call for onclick of elements
function doUpdate(ele,isDir=false){ function doUpdate(ele,isDir=false){
//console.log(ele.attr('data-choice'))
if(!isDir){ if(!isDir){
currSel.loc = ele.attr('data-choice') currSel.loc = ele.attr('data-choice')
$('.nav-bottom-text').html( (currSel.name = ele.html()) ) $('.nav-bottom-text').html( (currSel.name = ele.html()) )
@@ -58,7 +68,7 @@ function doUpdate(ele,isDir=false){
}, },
err=>{ err=>{
console.log(`E:Something went wrong: ${JSON.stringify(err)}`) console.log(`E:Something went wrong: ${JSON.stringify(err)}`)
}).finally() })
} }
} }