@vendia/share-sdk

v2.16.0

Published

Vendia Share SDK

Downloads

243

Readme

Vendia Share SDK

Vendia's javascript SDK.

Install

npm install @vendia/share-sdk

Usage

import VendiaShareSDK from '@vendia/share-sdk'
import Auth from '@aws-amplify/auth'

/* Get current AWS creds */
async function getCredentials() {
  return new Promise((resolve) => {
    Auth.currentCredentials()
      .then((creds) => resolve(creds))
      .catch((err) => resolve({}))
  })
}


const client = new VendiaShareSDK({
  baseURL: config.shareApi,
  getCredentials: Auth.currentCredentials,
  onError: async (error) => {
    // API 403 error
  }
})


async function usage() {
  const unis = await client.listUnis()
  console.log('unis', unis)
}

Development

When making changes to the Apps and the SDK at the same time it is required that you run npm run watch. If you do not make these changes then the apps will not be synced with the latest library changes.

Contribution notes

This package is used by the Vendia share app and caution should be used when removing fields in graphql queries etc.