-
Notifications
You must be signed in to change notification settings - Fork 12
/
App.js
52 lines (36 loc) · 1.13 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react';
//Import Styling
import './App.css';
//Import Firbase component
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
import 'firebase/analytics';
//Import FirebaseAuth component
import { useAuthState } from 'react-firebase-hooks/auth';
// Importing Component
import Header from './components/Header';
import SignIn from './components/Signin';
import ChatRoom from './components/ChatRoom';
firebase.initializeApp({
apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_FIREBASE_MSG_SENDER_ID,
appId: process.env.REACT_APP_FIREBASE_APP_ID,
measurementId: process.env.REACT_APP_FIREBASE_MEASUREMENT_ID
})
const auth = firebase.auth();
function App() {
const [user] = useAuthState(auth);
return (
<div className="App">
<Header />
<section>
{user ? <ChatRoom /> : <SignIn />}
</section>
</div>
);
}
export default App;