-
Notifications
You must be signed in to change notification settings - Fork 0
/
Login.js
44 lines (38 loc) · 1.27 KB
/
Login.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
import { Button } from '@material-ui/core';
import React from 'react';
import { auth,provider } from "./firebase";
import "./Login.css"
import { actionTypes } from './reducer';
import { useStateValue } from './StateProvider';
function Login() {
const[{},dispatch]= useStateValue();
const signIn= () => {
auth
.signInWithPopup(provider)
.then((result) =>{
dispatch({
type:actionTypes.SET_USER,
user:result.user,
});
})
//console.log(result))
.catch((error)=>alert(error.messsage));
};
return (
<div className="login">
<div className="login__container">
<p>hello.... Albin here</p>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/598px-WhatsApp.svg.png"
alt=""
/>
<div className="login__text">
<h1>sign in WhatsApp</h1>
</div>
<Button onClick={signIn}>
Sign In With Google
</Button>
</div>
</div>
)
}
export default Login