mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	Update Terms of Use Modal and fix message flashing.
This commit is contained in:
		@@ -5,6 +5,7 @@ nopaque.app.Client = class Client {
 | 
			
		||||
    // Endpoints
 | 
			
		||||
    this.corpora = new nopaque.app.endpoints.Corpora(this);
 | 
			
		||||
    this.jobs = new nopaque.app.endpoints.Jobs(this);
 | 
			
		||||
    this.main = new nopaque.app.endpoints.Main(this);
 | 
			
		||||
    this.settings = new nopaque.app.endpoints.Settings(this);
 | 
			
		||||
    this.users = new nopaque.app.endpoints.Users(this);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								app/static/js/app/endpoints/main.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/static/js/app/endpoints/main.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
nopaque.app.endpoints.Main = class Main {
 | 
			
		||||
  constructor(app) {
 | 
			
		||||
    this.app = app;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async acceptTermsOfUse() {
 | 
			
		||||
    const options = {
 | 
			
		||||
      headers: {
 | 
			
		||||
        Accept: 'application/json',
 | 
			
		||||
        'Content-Type': 'application/json'
 | 
			
		||||
      },
 | 
			
		||||
      method: 'POST',
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    const response = await fetch(`/accept-terms-of-use`, options);
 | 
			
		||||
    const data = await response.json();
 | 
			
		||||
 | 
			
		||||
    if (!response.ok) {throw new Error(`${data.name}: ${data.description}`);}
 | 
			
		||||
 | 
			
		||||
    return data;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -71,10 +71,7 @@ nopaque.app.extensions.UI = class UI {
 | 
			
		||||
    M.Modal.init(
 | 
			
		||||
      document.querySelector('#terms-of-use-modal'),
 | 
			
		||||
      {
 | 
			
		||||
        dismissible: false,
 | 
			
		||||
        onCloseEnd: (modalElement) => {
 | 
			
		||||
          nopaque.requests.users.entity.acceptTermsOfUse();
 | 
			
		||||
        }
 | 
			
		||||
        dismissible: false
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
    // #endregion
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user