From 41e5fd5f139b72703db614a878bba8dd18f22408 Mon Sep 17 00:00:00 2001 From: Mariano Riefolo Date: Tue, 3 Sep 2024 17:17:04 +0200 Subject: [PATCH] feat(frontend): add button to clear configuration --- static/index.js | 9 +++++++++ templates/index.html | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/static/index.js b/static/index.js index 09acbcb..ae854e6 100644 --- a/static/index.js +++ b/static/index.js @@ -169,11 +169,20 @@ function select_class() { Cookies.set("class", student_class); } +function delete_cookies() { + Cookies.remove("id"); + Cookies.remove("type"); + Cookies.remove("teacher"); + Cookies.remove("class"); +} + if (Cookies.get("id") && Cookies.get("type")) { if (Cookies.get("type") === "teacher" && Cookies.get("teacher")) { make_teacher_table(Cookies.get("id"), Cookies.get("teacher")); + document.getElementById("dashboard").removeAttribute("hidden"); } else if (Cookies.get("type") === "student" && Cookies.get("class")) { make_student_table(Cookies.get("id"), Cookies.get("class")); + document.getElementById("dashboard").removeAttribute("hidden"); } } else { document.getElementById("forms").removeAttribute("hidden"); diff --git a/templates/index.html b/templates/index.html index a09a34b..58d5aa2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -64,7 +64,12 @@ -
+