fix types

This commit is contained in:
Ruidy 2021-04-03 19:16:51 +02:00
parent 76467304ed
commit 64bc86a327
2 changed files with 6 additions and 9 deletions

View file

@ -5,7 +5,7 @@ import { App } from "./App";
import * as serviceWorker from "./serviceWorker";
import { Auth0Provider } from "./utils/auth0-spa";
import history from "./utils/history";
import Firebase, { FirebaseContext } from "./services/Firebase";
import { FirebaseContext } from "./services/Firebase";
const onRedirectCallBack = (appState) => {
history.push(

View file

@ -1,8 +1,5 @@
import app from "firebase/app";
import "firebase/firestore";
import CollectionReference = app.firestore.CollectionReference;
import Firestore = app.firestore.Firestore;
import DocumentData = app.firestore.DocumentData;
const CONFIG = {
apiKey: process.env.REACT_APP_API_KEY,
@ -22,8 +19,8 @@ const FAVS = "favs";
* Firebase services as auth and firestore.
*/
export default class Firebase {
#db: Firestore;
#collection: CollectionReference;
#db: any;
#collection: any;
constructor() {
app.initializeApp(CONFIG);
@ -49,7 +46,7 @@ export default class Firebase {
* Get user's favourite recipes
* */
getFavsByEmail = async (email: string) => {
let favs = [] as DocumentData[];
let favs = [] as any[];
const query = await this.#collection
.doc(email)
.collection(FAVS)
@ -57,7 +54,7 @@ export default class Firebase {
.limit(10)
.get();
query.forEach((doc) => favs.push(doc.data()));
query.forEach((doc: any) => favs.push(doc.data()));
return favs;
};
@ -94,6 +91,6 @@ export default class Firebase {
strMealThumb,
isFav,
})
.catch((err) => console.error("Error adding favs to database", err));
.catch((err: any) => console.error("Error adding favs to database", err));
};
}