mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	Merge branch 'public-corpus' of gitlab.ub.uni-bielefeld.de:sfb1288inf/nopaque into public-corpus
This commit is contained in:
		@@ -777,4 +777,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