mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-12 09:00:40 +00:00
share link generator update
This commit is contained in:
@ -751,4 +751,34 @@ class Utils {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
static generateCorpusShareLinkRequest(corpusId, permission, expiration) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = {permission: permission, expiration: expiration};
|
||||
fetch(`/corpora/${corpusId}/generate-corpus-share-link`, {method: 'POST', headers: {Accept: 'text/plain'}, body: JSON.stringify(data)})
|
||||
.then(
|
||||
(response) => {
|
||||
if (!response.ok) {
|
||||
app.flash(`Something went wrong: ${response.status} ${response.statusText}`, 'error');
|
||||
reject(response);
|
||||
return;
|
||||
}
|
||||
return response.text();
|
||||
},
|
||||
(response) => {
|
||||
// Something went wrong during the HTTP request
|
||||
app.flash('Something went wrong', 'error');
|
||||
reject(response);
|
||||
}
|
||||
)
|
||||
.then(
|
||||
(corpusShareLink) => {resolve(corpusShareLink);},
|
||||
(error) => {
|
||||
// Something went wrong during ReadableStream processing
|
||||
app.flash('Something went wrong', 'error');
|
||||
reject(error);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user