I need to find those lines from all documents where there will be a match and return it. First, I take a ready-made collection of genres and look for a slug match in it. Then I try to find all collections where there is a match in the genres object. After the first request, I try to get the next 25 elements, but there is no "data" method in the "next" variable, what did I do wrong? Next I try to gradually add new elements to the array
state: () => ({
orderedGenres: [],
}),
mutations: {
loadMoreFilms(state, data) {
state.orderedGenres.push(data);
},}
async GetFilmsByGenre({ state, commit }, genreSlug) {
try {
commit("setLoading", true);
let genre = state.genres.find((p) => p.slug === genreSlug);
let documentSnapshots = await getDocs(
query(
collection(db, "films"),
where("genres", "array-contains", genre.name),
limit(25)
)
);
const lastVisible =
documentSnapshots.docs[documentSnapshots.docs.length - 1];
const next = await getDocs(
query(
collection(db, "films"),
where("genres", "array-contains", genre.name),
startAfter(lastVisible),
limit(25)
)
);
let data = {
...next.data(),
};
commit("loadMoreFilms", data);
} catch (err) {
console.error(err);
} finally {
commit("setLoading", false);
}
},

