feat: add facebook login

Resolves #36
This commit is contained in:
Lakhan Samani
2021-09-05 03:57:29 +05:30
parent af3222b5e0
commit 88d2195c0a
7 changed files with 132 additions and 67 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,51 +2,41 @@ import React from 'react';
import { useAuthorizer } from '@authorizerdev/authorizer-react';
export default function Dashboard() {
const [loading, setLoading] = React.useState(false);
const { user, setToken, graphQlRef } = useAuthorizer();
const [loading, setLoading] = React.useState(false);
const { user, setToken, authorizerRef } = useAuthorizer();
const onLogout = async () => {
setLoading(true);
await graphQlRef
.mutation(
`
mutation {
logout {
message
}
}
`
)
.toPromise();
setToken(null);
setLoading(false);
};
const onLogout = async () => {
setLoading(true);
await authorizerRef.logout();
setToken(null);
setLoading(false);
};
return (
<div>
<h1>Hey 👋,</h1>
<p>Thank you for joining authorizer demo app.</p>
<p>
Your email address is{' '}
<a href={`mailto:${user?.email}`} style={{ color: '#3B82F6' }}>
{user?.email}
</a>
</p>
return (
<div>
<h1>Hey 👋,</h1>
<p>Thank you for joining authorizer demo app.</p>
<p>
Your email address is{' '}
<a href={`mailto:${user?.email}`} style={{ color: '#3B82F6' }}>
{user?.email}
</a>
</p>
<br />
{loading ? (
<h3>Processing....</h3>
) : (
<h3
style={{
color: '#3B82F6',
cursor: 'pointer',
}}
onClick={onLogout}
>
Logout
</h3>
)}
</div>
);
<br />
{loading ? (
<h3>Processing....</h3>
) : (
<h3
style={{
color: '#3B82F6',
cursor: 'pointer',
}}
onClick={onLogout}
>
Logout
</h3>
)}
</div>
);
}