"use client"
import React, { useEffect} from "react";
import { useDispatch } from "react-redux";
import { AppDispatch } from "@/store/store";
import Cookies from "js-cookie";
import { IoPersonOutline } from "react-icons/io5";
import { deleteAuthedUserData, getAuthedUserData } from "@/store/profile";
import LocalePath from "@/components/UiComponents/LocalePath";
import AuthWrapper from "../AuthWrapper";

const Profile = () => {
  const dispatch = useDispatch<AppDispatch>();

  useEffect(() => {
    if(Cookies.get("user_token")){
        dispatch(getAuthedUserData());
    }else{
      dispatch(deleteAuthedUserData())
    }
  }, []);

  return (
  <AuthWrapper>
    <LocalePath href="/account/personal"><IoPersonOutline className="cursor-pointer" size={25}/></LocalePath>
  </AuthWrapper>
  )

}
export default Profile;
