Skip to content

Commit

Permalink
[FIX] update OpenNeuro transfer with JWT
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Levitas committed Jul 9, 2024
1 parent 4dbad13 commit 4e9e884
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ ui/src/components/modalityForm.vue
ui/src/libUnsafe.ts
handler/convert.js
ui/test/events/*.js
api/*.ts
api/*.ts
ui/src/Finalize.vue
22 changes: 17 additions & 5 deletions ui/src/Finalize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,23 @@ export default defineComponent({
);
},
sendOpenneuro() {
const url =
this.config.apihost + '/download/' + this.session._id + '/bids/' + this.ezbids.datasetDescription.Name;
const fullurl = new URL(url, document.baseURI).href;
window.open('https://openneuro.org/import?url=' + encodeURI(fullurl));
async sendOpenneuro() {
try {
const res = await axios.get(`${this.config.apihost}/download/${this.session._id}/token`);
const shortLivedJWT = res.data;
const url = `${this.config.apihost}/download/${this.session._id}/bids/${this.ezbids.datasetDescription.Name}?token=${shortLivedJWT}`;
const fullurl = new URL(url, document.baseURI).href;
window.open('https://openneuro.org/import?url=' + encodeURI(fullurl));
} catch (e) {
console.error(e);
ElNotification({
message: 'there was an error downloading the data',
type: 'error',
});
}
},
isValid(cb: (err?: string) => void) {
Expand Down

0 comments on commit 4e9e884

Please sign in to comment.