Skip to main content

Getting Started

Installing

You can install aircampi's form via NPM, Yarn or CDN.

NPM:

  npm install @aircampi/form

Yarn:

  yarn add @aircampi/form

CDN:

  <script src="https://cdn.jsdelivr.net/npm/@aircampi/form"/>

//or

<script src="https://unpkg.com/@aircampi/form"/>

Find the source code on GitHub.

Initializing

There are 2 way to initialize new client.

Using createFormClient():


import { createFormClient } from '@aircampi/form'

// Create a Form client for interacting with your form stack

const form = createFormClient({
domain: '<YOUR_DOMAIN>',
client_id: '<YOUR_CLIENT_ID>'
})

Using FormClient object


import { FormClient } from '@aircampi/form';

const form = new FormClient({
domain: '<YOUR_DOMAIN>',
client_id: '<YOUR_CLIENT_ID>'
});

//if you do this, you'll need to get list of buckets

try {
await form.getBuckets();
} catch (error) {
if (error.error !== 'login_required') {
throw error;
}
}