mirror of
https://github.com/wekan/wekan.git
synced 2025-12-27 20:58:48 +01:00
Export Wekan now server-based with proper auth
This commit is contained in:
parent
efe7c21d57
commit
d08e1cc45b
6 changed files with 42 additions and 26 deletions
|
|
@ -1,4 +1,3 @@
|
|||
/* global saveAs */
|
||||
Template.boardMenuPopup.events({
|
||||
'click .js-rename-board': Popup.open('boardChangeTitle'),
|
||||
'click .js-open-archives'() {
|
||||
|
|
@ -14,25 +13,18 @@ Template.boardMenuPopup.events({
|
|||
// confirm that the board was successfully archived.
|
||||
FlowRouter.go('home');
|
||||
}),
|
||||
'click .js-export-board'() {
|
||||
const boardId = Session.get('currentBoard');
|
||||
Meteor.call('exportBoard', boardId, (error, response) => {
|
||||
if(error) {
|
||||
// the only error we can anticipate is accessing a non-authorized board
|
||||
// and this should have been caugh by UI before.
|
||||
// So no treatment here for the time being.
|
||||
} else {
|
||||
const dataToSave = new Blob([JSON.stringify(response)], {type: 'application/json;charset=utf-8'});
|
||||
const filename = `wekan-export-board-${boardId}.json`;
|
||||
saveAs(dataToSave, filename);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Template.boardMenuPopup.helpers({
|
||||
urlExport() {
|
||||
return Meteor.absoluteUrl(`api/b/${Session.get('currentBoard')}`);
|
||||
exportUrl() {
|
||||
const boardId = Session.get('currentBoard');
|
||||
const userId = Meteor.userId();
|
||||
const loginToken = Accounts._storedLoginToken();
|
||||
return Meteor.absoluteUrl(`api/b/${boardId}/${userId}/${loginToken}`);
|
||||
},
|
||||
exportFilename() {
|
||||
const boardId = Session.get('currentBoard');
|
||||
return `wekan-export-board-${boardId}.json`;
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue