<script setup lang="ts">
import Menu from "@/components/Menu.vue";
import {useRouter} from "vue-router";
import {onBeforeMount} from "vue";
import {checkIfLoggedIn} from "@/helpers/api.ts";
import Panel from "primevue/panel";
import Fieldset from 'primevue/fieldset';
import PasswordChanger from "@/components/PasswordChanger.vue";

const router = useRouter();

onBeforeMount(async () => {
  const loggedIn = await checkIfLoggedIn();
  if (!loggedIn) {
    await router.push('/login');
    return;
  }
});
</script>

<template>
  <div class="p-5 space-y-5 h-full">
    <Menu />
    <Panel header="Settings" class="h-[85vh]">
      <Fieldset legend="Password" class="w-max">
        <PasswordChanger />
      </Fieldset>
    </Panel>
  </div>
</template>

<style scoped>

</style>