import {timestampToDate, useAuth} from "#imports";
import type {SessionUserTypes} from "~/types/sessionUserTypes";
export const useSessionLogin = async (key:string) => {
  const {status,data,getSession} = useAuth()    // console.log(getSession())
  const getSess = await getSession({required:true})
  // console.log(await getSession())
  if(key=='getSess'){
  //   const sessionUser:SessionUserTypes ={
  //     userName:getSess?.session_user_payload?.preferred_username||'',
  //     typeUser:getSess?.session_user_payload?.type_user||'',
  //     isAuthenticated:getSess?.isAuthenticated||'false',
  //     roleUser:getSess?.session_user_payload?.resource_access[getSess?.session_user_payload.azp]||'',
  //     userInfo:{
  //       id:getSess?.user?.id||'',
  //       fullName:getSess?.session_user_payload?.name||'',
  //       givenName:getSess?.session_user_payload?.given_name||'',
  //       familyName:getSess?.session_user_payload?.family_name||'',
  //       email:getSess?.session_user_payload?.email||'',
  //       group:getSess?.session_user_payload?.group||''
  //     },
  //     expires_in:{
  //       timestamps:getSess?.expires_at||0,
  //       date:timestampToDate(getSess?.expires_at, 'id-ID')||''
  //     }
  //   }
    return getSess;
  }
}