Further js refactoring

This commit is contained in:
Patrick Jentsch
2024-12-05 14:26:05 +01:00
parent df2bffe0fd
commit c97b2a886e
18 changed files with 110 additions and 68 deletions

View File

@ -9,9 +9,13 @@
output='gen/nopaque.%(version)s.js',
'js/index.js',
'js/app.js',
'js/app/ui.js',
'js/app/user-live-registry.js',
'js/app/users.js',
'js/app/index.js',
'js/app/endpoints/index.js',
'js/app/endpoints/users.js',
'js/app/extensions/index.js',
'js/app/extensions/toaster.js',
'js/app/extensions/ui.js',
'js/app/extensions/user-hub.js',
'js/utils.js',
'js/forms/index.js',
@ -80,16 +84,18 @@
const app = new nopaque.App();
app.init();
{% if current_user.is_authenticated -%}
{% if current_user.is_authenticated %}
const currentUserId = {{ current_user.hashid|tojson }};
app.liveUserRegistry.add(currentUserId)
app.userHub.add(currentUserId)
.catch((error) => {throw JSON.stringify(error);});
{% if not current_user.terms_of_use_accepted -%}
{% if not current_user.terms_of_use_accepted %}
M.Modal.getInstance(document.querySelector('#terms-of-use-modal')).open();
{% endif -%}
{% endif -%}
{% endif %}
{% else %}
const currentUserId = null;
{% endif %}
// Display flashed messages
for (let [category, message] of {{ get_flashed_messages(with_categories=True)|tojson }}) {