mirror of
https://github.com/rjNemo/meal_planner
synced 2026-06-12 13:26:45 +00:00
fix types
This commit is contained in:
parent
76467304ed
commit
64bc86a327
2 changed files with 6 additions and 9 deletions
|
|
@ -5,7 +5,7 @@ import { App } from "./App";
|
||||||
import * as serviceWorker from "./serviceWorker";
|
import * as serviceWorker from "./serviceWorker";
|
||||||
import { Auth0Provider } from "./utils/auth0-spa";
|
import { Auth0Provider } from "./utils/auth0-spa";
|
||||||
import history from "./utils/history";
|
import history from "./utils/history";
|
||||||
import Firebase, { FirebaseContext } from "./services/Firebase";
|
import { FirebaseContext } from "./services/Firebase";
|
||||||
|
|
||||||
const onRedirectCallBack = (appState) => {
|
const onRedirectCallBack = (appState) => {
|
||||||
history.push(
|
history.push(
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
import app from "firebase/app";
|
import app from "firebase/app";
|
||||||
import "firebase/firestore";
|
import "firebase/firestore";
|
||||||
import CollectionReference = app.firestore.CollectionReference;
|
|
||||||
import Firestore = app.firestore.Firestore;
|
|
||||||
import DocumentData = app.firestore.DocumentData;
|
|
||||||
|
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
apiKey: process.env.REACT_APP_API_KEY,
|
apiKey: process.env.REACT_APP_API_KEY,
|
||||||
|
|
@ -22,8 +19,8 @@ const FAVS = "favs";
|
||||||
* Firebase services as auth and firestore.
|
* Firebase services as auth and firestore.
|
||||||
*/
|
*/
|
||||||
export default class Firebase {
|
export default class Firebase {
|
||||||
#db: Firestore;
|
#db: any;
|
||||||
#collection: CollectionReference;
|
#collection: any;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
app.initializeApp(CONFIG);
|
app.initializeApp(CONFIG);
|
||||||
|
|
@ -49,7 +46,7 @@ export default class Firebase {
|
||||||
* Get user's favourite recipes
|
* Get user's favourite recipes
|
||||||
* */
|
* */
|
||||||
getFavsByEmail = async (email: string) => {
|
getFavsByEmail = async (email: string) => {
|
||||||
let favs = [] as DocumentData[];
|
let favs = [] as any[];
|
||||||
const query = await this.#collection
|
const query = await this.#collection
|
||||||
.doc(email)
|
.doc(email)
|
||||||
.collection(FAVS)
|
.collection(FAVS)
|
||||||
|
|
@ -57,7 +54,7 @@ export default class Firebase {
|
||||||
.limit(10)
|
.limit(10)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
query.forEach((doc) => favs.push(doc.data()));
|
query.forEach((doc: any) => favs.push(doc.data()));
|
||||||
|
|
||||||
return favs;
|
return favs;
|
||||||
};
|
};
|
||||||
|
|
@ -94,6 +91,6 @@ export default class Firebase {
|
||||||
strMealThumb,
|
strMealThumb,
|
||||||
isFav,
|
isFav,
|
||||||
})
|
})
|
||||||
.catch((err) => console.error("Error adding favs to database", err));
|
.catch((err: any) => console.error("Error adding favs to database", err));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue