opesjs
v0.7.43
Published
The OPES JavaScript SDK
Downloads
29
Readme
opes.js
The OPES JavaScript SDK
Installation
npm i -S opesjs
Importing into your code
import { OPES } from 'opesjs';
OPES Connect
Use as a React Hook
const { isConnecting, accessToken, startConnecting } = OPES.useConnect(<API KEY>)
const onConnect = () => {
startConnecting()
}
const useEffect = (() => {
console.log("Got the Access Token", accessToken)
}, [accessToken])
const ConnectButton = () => {
if (isConnecting) {
return <h1>Connecting ... </h1>
}
return <a className={styles} onClick={onConnect}>
<h1>OPES Connect →</h1>
</a>
}
return <ConnectButton/>
Use as plain JS
const accessToken = await OPES.Connect.getAccessToken(<API KEY>)