1.2.6 • Published 2 years ago
@freevuehub/reacth v1.2.6
Reacth (React-Auth)
Installation
NPM: npm install @freevuehub/reacth --save
Yarn: yarn add @freevuehub/reacth
Usage
import React from 'react'
import { Google } from '@freevuehub/reacth'
const CLIENT_KEY = '<Google OAuth Client Key>'
const App: React.FC = (props) => {
return (
<Google.Provider client-key={CLIENT_KEY}>
{props.children}
</Google.Provider>
)
}
import React, { useContext } from 'react'
import { Google } from '@freevuehub/reacth'
const Home: React.FC = (props) => {
const { signIn, signOut, user } = useContext(Google.Context)
const onSignInClick = async (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault()
await signIn()
}
const onSignOutClick = async (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault()
await signOut()
}
return (
<>
<div>
<button onClick={onSignInClick}>Sign In</button>
<button onClick={onSignOutClick}>Sign Out</button>
</div>
<h1>{user.name}</h1>
</>
)
}
User Response Data
Key | Type |
---|---|
id | Int |
name | String |
String | |
image | String |
1.2.0
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.1.9
2 years ago
1.1.8
2 years ago
1.2.6
2 years ago
1.1.7
2 years ago
1.2.5
2 years ago
1.1.6
2 years ago
1.2.4
2 years ago
1.1.5
2 years ago
1.2.3
2 years ago
1.1.4
2 years ago
1.2.2
2 years ago
1.1.3
2 years ago
1.2.1
2 years ago
1.1.2
2 years ago
1.1.12
2 years ago
1.1.11
2 years ago
1.1.10
2 years ago
1.1.14
2 years ago
1.1.13
2 years ago
0.7.10
3 years ago
0.7.9
3 years ago
0.7.8
3 years ago
0.7.7
3 years ago
0.7.6
3 years ago
0.7.5
3 years ago
0.7.4
3 years ago
0.7.3
3 years ago
0.7.2
3 years ago
0.7.1
3 years ago
0.7.0
3 years ago
0.6.2
3 years ago
0.6.1
3 years ago
0.6.0
3 years ago
0.5.8
3 years ago
0.5.7
3 years ago
0.5.6
3 years ago
0.5.5
3 years ago
0.5.4
3 years ago
0.5.3
3 years ago
0.5.2
3 years ago
0.5.1
3 years ago
0.5.0
3 years ago