react-dynamodb-helper
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "react-dynamodb-helper", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A helper component to interface with dynamodb using the AWS SDK, directly from React", | ||
@@ -5,0 +5,0 @@ "author": "superflows-dev", |
@@ -13,2 +13,9 @@ # react-dynamodb-helper | ||
## Dependencies | ||
```bash | ||
npm install --save aws-sdk | ||
``` | ||
## Usage | ||
@@ -24,23 +31,22 @@ | ||
useEffect(() => { | ||
async function getData() { | ||
var params = { | ||
TableName: "Account_Credentials", | ||
Key : { | ||
"email" : 'hru****@***ies.com', | ||
} | ||
}; | ||
const apiCall = async () => { | ||
// aws_secret and aws_access_key need to have | ||
// dynamodb access | ||
let result = await DynamoDB.getData("aws_region", "aws_secret", "aws_access_key", params) | ||
var params = { | ||
TableName: "Account_Credentials", | ||
Key : { | ||
"email" : 'hrushi@megotechnologies.com', | ||
} | ||
}; | ||
} | ||
getData(); | ||
let result = await DynamoDB.getData("ap-XXXX-1", "aws_secret", "aws_access_key", params) | ||
}, []) | ||
} | ||
useEffect(() => { | ||
async function fetchData() { | ||
await apiCall(); | ||
} | ||
fetchData(); | ||
}, []) | ||
return <div>Hello DynamoDB Helper</div> | ||
@@ -51,3 +57,2 @@ } | ||
``` | ||
@@ -54,0 +59,0 @@ |
86198
60