diff --git a/app/(protected)/dashboard/_hooks/useUserProfile.ts b/app/(protected)/dashboard/_hooks/useUserProfile.ts index 27aad53..b0ee7ed 100644 --- a/app/(protected)/dashboard/_hooks/useUserProfile.ts +++ b/app/(protected)/dashboard/_hooks/useUserProfile.ts @@ -8,8 +8,6 @@ import { toast } from 'react-toastify'; export const useUserProfile = () => { const { user } = useAuth(); - console.log(user); - const [loading, setLoading] = useState(true); const [userForm, setUserForm] = useState({ displayName: user?.displayName || '', diff --git a/app/_apis/auth.ts b/app/_apis/auth.ts index fb624b5..375adc0 100644 --- a/app/_apis/auth.ts +++ b/app/_apis/auth.ts @@ -5,3 +5,5 @@ import myAxios from './myAxios.config'; export const registerUser = async (data: RegisterUserData) => myAxios.post('/auth/signup', data); export const verifySession = async () => myAxios.get('/api/v1/auth/me'); + +export const generateUser = async () => myAxios.post('/api/v1/user/create'); diff --git a/app/_components/AsideRoom.tsx b/app/_components/AsideRoom.tsx index a34c061..2e6c7d3 100644 --- a/app/_components/AsideRoom.tsx +++ b/app/_components/AsideRoom.tsx @@ -51,7 +51,7 @@ export default function AsideRoom() {
  • {room.name}

    -

    {room.lastMessage.content}

    +

    {room.lastMessage.content}

  • ))} diff --git a/app/_hooks/useAuth.tsx b/app/_hooks/useAuth.tsx index 72b8fbc..59ab841 100644 --- a/app/_hooks/useAuth.tsx +++ b/app/_hooks/useAuth.tsx @@ -12,7 +12,7 @@ import { } from 'firebase/auth'; import { auth, googleProvider } from '../_lib/_firebase/firebase.config'; import { loginSchema, registerSchema } from '../(auth)/login/_lib/_schemas/auth'; -import { registerUser } from '../_apis/auth'; +import { generateUser, registerUser } from '../_apis/auth'; import { createSession, deleteSession } from '../(auth)/login/_lib/_actions/session'; import { GoogleAuthProvider } from 'firebase/auth/web-extension'; @@ -84,6 +84,8 @@ export const useAuth = create()(set => ({ // Crear una sesión con el token obtenido await createSession(token); + + await generateUser(); } catch (error) { console.error('Error during Google login:', error); }