// Header functionality

import { Alpine } from "./alpine";
import { initializeSearch } from "./search";
import {
  initializeTheme,
  changeTheme,
  changeWoodPaneling,
  loadWoodPaneling,
  updateWoodPanelingIndicators,
} from "./theme";

const logout = (): void => {
  localStorage.removeItem("token");
  localStorage.removeItem("user");
  window.location.href = "/";
};

export { logout };

Alpine.data("header", () => ({
  logout,
  initializeSearch,
  initializeTheme,
  changeTheme,
  changeWoodPaneling,
  loadWoodPaneling,
  updateWoodPanelingIndicators,
}));
