Im doing a Netflix clone while watching this video and im at 2:18:32. This video got shared by Sonny 6 months ago. So its not updated. And im receiving errors when i do the things that shared 6 months ago. at 2:18:32 of video, what should i do in firebase.js and SignupScreen.js to be avoid of errors.
I have tried that before posting this thread. I did this into SignupScreen.js.
import { useRef } from "react";
import React from 'react';
import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword } from "firebase/auth";
import "./SignupScreen.css";
function SignupScreen() {
const emailRef = useRef(null);
const passwordRef = useRef(null);
const register = (e) => {
const auth = getAuth();
createUserWithEmailAndPassword (auth, emailRef.current.value, passwordRef.current.value)
.then((userCredential) => {
const user = userCredential.user;
console.log(user);
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert (errorCode, errorMessage)
});
};
const signIn = (e) => {
const auth = getAuth();
signInWithEmailAndPassword (auth, emailRef.current.value, passwordRef.current.value)
.then((userCredential) => {
const user = userCredential.user;
console.log(user);
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert (errorCode, errorMessage)
});
}`
And i have tried that in firebase.js :
import firebase from 'firebase';
import { signInWithEmailAndPassword, getAuth, createUserWithEmailAndPassword } from "firebase/auth";
const firebaseConfig = {
apiKey: "AIzaSyBhoDeCtm2ZS3qzr0eWX8IF9-VzvIHAoKQ",
authDomain: "netflix-clone-31bcf.firebaseapp.com",
projectId: "netflix-clone-31bcf",
storageBucket: "netflix-clone-31bcf.appspot.com",
messagingSenderId: "615955108716",
appId: "1:615955108716:web:39e22e96678e1141d3d949"
};
const firebaseApp = firebase.initializeApp(firebaseConfig);
const db = firebaseApp.firestore();
const auth = firebase.auth();
export { signInWithEmailAndPassword, getAuth, auth, createUserWithEmailAndPassword }
export default db;
And i got an error when i press to sign in button.
Error : Firebase: Need to provide options, when not being deployed to hosting via source. (app/no-options). FirebaseError: Firebase: Need to provide options, when not being deployed to hosting via source. (app/no-options).