Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

429
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!