Safety backup before Path A fixes - fixing function mismatches and missing functions

This commit is contained in:
2026-03-11 11:01:43 -04:00
parent 0a5042e130
commit 083f152b35
62 changed files with 202 additions and 261 deletions
+2 -29
View File
@@ -1,28 +1,6 @@
// Header functionality
import { Alpine } from "./alpine";
import { applyTheme } from "./theme";
import { updateThemeIndicators } from "./themeDropdown";
const changeTheme = (theme: string): void => {
// Apply the theme using the consolidated function from theme.ts
applyTheme(theme);
// Save to server if logged in
const token = localStorage.getItem("token");
if (token) {
fetch("/api/auth/theme", {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ theme }),
}).catch((err) => console.log("Theme save failed", err));
}
// Alpine closes dropdown automatically via template state
};
const logout = (): void => {
localStorage.removeItem("token");
@@ -30,13 +8,8 @@ const logout = (): void => {
window.location.href = "/";
};
export { changeTheme, logout };
export { logout };
Alpine.global("header", {
Alpine.store("header", {
logout,
changeThemeTo: (theme: string) => {
console.log("changeThemeTo called with:", theme);
changeTheme(theme);
updateThemeIndicators();
},
});