0.1.7 • Published 6 years ago
react-wovenpay v0.1.7
wovenpay React SDK for the wovenpay GraphQl API
Dependencies:
- woven-pay-js
- React
The package contains common queries and a React Component - WovenQuery Component
import WovenQuery from 'react-wovenpay'; 2.3kb
//OR
import WovenQuery from 'react-wovenpay/api/graphql'; 1.2kb
import allBusinesses from 'react-wovenpay/api/queries/business'; 458B
let token = "testtoken" //The Merchant JWT token
<WovenQuery token={token} query={allBusinesses}>
{({loaded, data}) => {
if(!loaded){
return <p>loading...</p>;
}
let businesses = data.allBusinesses.edges;
if(loaded && businesses.length ===0){
return <p>No active business</p>;
}
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">{businesses[0].node.name.toUpperCase()}</h1>
</header>
</div>
);
}}
</WovenQuery>
You can also write custom queries and pass it to the WovenQuery Component
const allBusinessesEmail = `
query allBusinesses {
allBusinesses {
edges {
node {
email
}
}
}
}
`;