From 6a80cd4e3535242a3be756d35374e0976f46e1b8 Mon Sep 17 00:00:00 2001 From: AdrienLSH Date: Wed, 10 Jan 2024 13:33:40 +0100 Subject: [PATCH] add: navbar links change when logged --- frontend/static/js/api/client.js | 12 ++++++++++++ frontend/templates/index.html | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/static/js/api/client.js b/frontend/static/js/api/client.js index 79110be..8bc52b5 100644 --- a/frontend/static/js/api/client.js +++ b/frontend/static/js/api/client.js @@ -107,10 +107,22 @@ class Client { this.me = new MyProfile(this); await this.me.init(); + [...document.getElementById('nav-account-links').children].forEach(el => { + if (el.matches('[logged-in]')) + el.classList.remove('d-none'); + else + el.classList.add('d-none'); + }); } else { this.me = undefined; + [...document.getElementById('nav-account-links').children].forEach(el => { + if (el.matches('[logged-in]')) + el.classList.add('d-none'); + else + el.classList.remove('d-none'); + }); } this._logged = state; } diff --git a/frontend/templates/index.html b/frontend/templates/index.html index 855019a..7e05bed 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -15,9 +15,11 @@ Search Home -