Ionic 5, React, Capacitor, fetchFirestoreCollection Error

99 Views Asked by At

I am attempting to use fetchFirestoreCollection to retrieve a collection, and continue to get "collection not found" so it appears as though something in the .ts file may be off? I can successfully log into the app, but unable to retrieve from firestore. Thanks in advence!

Code as follows;

 var filters = [
        ['where', 'type', '==', 'news', 'string']
    ];

// @ts-ignore
    const fetchHome = async() => {
        // @ts-ignore
        await FirebaseX.fetchFirestoreCollection('home',function(documents){
            // @ts-ignore
                setEntries(JSON.stringify(documents));
            console.log("Successfully fetched collection: "+JSON.stringify(documents));
        },
            // @ts-ignore
            function(error: string){
                // @ts-ignore
            console.error("Error fetching document: "+error);
        });
    }
    useEffect(() => {

        fetchHome().then(r => {});
        console.log('entries: ', entries);
    }, []);
0

There are 0 best solutions below