upload now works
This commit is contained in:
parent
a6f17c7105
commit
f920f0cccd
|
@ -15,7 +15,7 @@ function handleFiles(ev) {
|
|||
// 'vm' is the Controller As name.
|
||||
vm = $scope.vm;
|
||||
vm.currentFiles = ev.target.files;
|
||||
console.log(vm.currentFiles);
|
||||
console.log('vm.currentFiles', vm.currentFiles);
|
||||
}
|
||||
window.document.body.addEventListener('change', handleFiles);
|
||||
|
||||
|
@ -24,17 +24,14 @@ app.controller('websiteCtrl', [
|
|||
, function ($scope, $q, Auth, Oauth3) {
|
||||
|
||||
var vm = this;
|
||||
vm.oauth3 = Auth.oauth3;
|
||||
vm.domains = [];
|
||||
|
||||
Auth.api = function (apiname, opts) {
|
||||
var els = [];
|
||||
|
||||
return $q.all(Auth.sessions.map(function (session) {
|
||||
console.log('################ Auth.api session:', session.issuer, session.subject);
|
||||
|
||||
return Auth.select(session).then(function (oauth3) {
|
||||
console.log('$$$$$$$$$$$$$$$ Auth.api session:', session.issuer, session.subject);
|
||||
|
||||
return oauth3.api(apiname, {}).then(function (collection) {
|
||||
|
||||
|
@ -57,7 +54,6 @@ app.controller('websiteCtrl', [
|
|||
});
|
||||
});
|
||||
})).then(function (results) {
|
||||
console.log('################ Auth.api session END');
|
||||
return els;
|
||||
});
|
||||
};
|
||||
|
@ -68,7 +64,7 @@ app.controller('websiteCtrl', [
|
|||
});
|
||||
|
||||
vm.getDomains = function () {
|
||||
return vm.oauth3.api('domains.list', {}).then(function (result) {
|
||||
return Auth.oauth3.api('domains.list', {}).then(function (result) {
|
||||
vm.domains = result.registrations || result;
|
||||
});
|
||||
};
|
||||
|
@ -108,8 +104,7 @@ app.controller('websiteCtrl', [
|
|||
}
|
||||
}
|
||||
});
|
||||
console.log('records');
|
||||
console.log(records);
|
||||
console.log('dns records', records);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -121,7 +116,7 @@ app.controller('websiteCtrl', [
|
|||
|
||||
vm.createWebsite = function () {
|
||||
var fd = new window.FormData();
|
||||
var pkg = vm.oauth3.pkg('www@daplie.com');
|
||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||
//vm.unlock('webpreneur');
|
||||
if (!vm.currentFiles || !vm.currentFiles.length) {
|
||||
window.alert('No files chosen.');
|
||||
|
@ -136,7 +131,10 @@ app.controller('websiteCtrl', [
|
|||
return;
|
||||
}
|
||||
|
||||
return pkg.add({ hostname: vm.currentHost, multipart: { site: vm.currentFiles[0] } });
|
||||
console.log('Auth.oauth3', Auth.oauth3);
|
||||
return pkg.add({ hostname: vm.currentHost, multipart: { site: vm.currentFiles[0] } }).then(function (result) {
|
||||
window.alert(JSON.stringify(result));
|
||||
});
|
||||
};
|
||||
|
||||
//vm.getDomains();
|
||||
|
|
|
@ -93,6 +93,11 @@ app.factory('Auth', [
|
|||
console.log('session.subject:', session.subject);
|
||||
console.log('session:', session);
|
||||
|
||||
promise.then(function (oauth3) {
|
||||
Auth.session = session;
|
||||
Auth.oauth3 = oauth3;
|
||||
})
|
||||
|
||||
return promise;
|
||||
}
|
||||
, signOut: function () {
|
||||
|
|
Loading…
Reference in New Issue