Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

434
Vistas
Cannot read properties of undefined (reading 'indexOf')

enter image description here

I want to save a collection in firebase name like when a use like a post I want to save it into the firebase firestore

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Do you have this imported?

import { useSession } from "next-auth/react";

Should the code look like this later? ; ) I follow the same tutorial. I was having problems with it too. I don't know how I solved this problem. Try my solution first. If that doesn't work, I can send you some extra stuff (that might have solved it).

const likePost = async () => {
    if (hasLiked) {
        await deleteDoc(doc(db, "posts", id, "likes", session.user.uid));
    } else {
        await setDoc(doc(db, "posts", id, "likes", session.user.uid), {
            username: session.user.username,
        });
    }
};
about 4 years ago · Juan Pablo Isaza Denunciar

0

const likePost = async () => {     
        await setDoc(doc(db, 'posts', id, 'likes', id), {
            username: session.user.name,
        })
    };

because de seesion.user.uid is undefined, i use id and its work

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda