Advertisement
shubhamgoyal

Untitled

Dec 8th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. const addOrUpdateImageInTable = (url, device, browser, otherInfo) => {
  2. console.log(`i am gonna do shit`)
  3. otherInfo = otherInfo ? otherInfo : {};
  4. return getItemPromise(getDynamoDBTableName(url), getDeviceBrowserKey(device, browser), url, {})
  5. .then((res) => {
  6. if (res) { // means the element exists, so we should update
  7. console.log(`res is ${res} so gonna update`)
  8. return updateImageInTable(url, device, browser, otherInfo);
  9. } else { // since it does not exist, let us create new one
  10. console.log(`res is ${res} so gonna create`);
  11. return addImageInTable(url, device, browser, otherInfo);
  12. }
  13. })
  14. .catch((err) => console.log(err))
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement