import { store } from "@/store";
export const user = {
  computed: {
    user() {
      return store.getters.getUserData;
    },
    loggedIn() {
      return store.getters.getIsLoggedIn;
    },
    initials() {
      const allNames = this.user.fullName.trim().split(" ");
      const initials = allNames.reduce(
        (acc, curr, index) => {
          if (index === 0 || index === allNames.length - 1) {
            acc = `${acc}${curr.charAt(0).toUpperCase()}`;
          }
          return acc;
        },
        [""]
      );
      return initials;
    },
  },
};
