import { defineStore } from "pinia";

export const useAccountStore = defineStore("account", {
  state: () => {
    return {
      firstname: "" as string,
      lastname: "" as string,
      mail: "" as string,
      alias: "" as string,
    };
  },
  actions: {
    logoutAccount() {
      localStorage.removeItem("accessToken");
      localStorage.removeItem("refreshToken");
      window.open("/login", "_self");
    },
    setAccountData(firstname: string, lastname: string, mail: string, alias: string) {
      this.firstname = firstname;
      this.lastname = lastname;
      this.mail = mail;
      this.alias = alias;
    },
  },
});