0.2.0 • Published 1 year ago

nuxt-reapit v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

nuxt-reapit

npm version

Reapit integration for Nuxt.

Setup

# pnpm
pnpm add -D nuxt-reapit

# npm
npm i -D nuxt-reapit

# yarn
yarn add -D nuxt-reapit

Usage

To get started, add the nuxt-reapit module to your nuxt.config.ts:

// `nuxt.config.ts`
export default defineNuxtConfig({
  modules: ['nuxt-reapit']
})

Set your Reapit Connect credentials by adding them to your project's .env file:

REAPIT_CONNECT_CLIENT_ID=
REAPIT_CONNECT_CLIENT_SECRET=
# The following are optional and default to the Reapit production URLs
REAPIT_CONNECT_API_URL=https://connect.reapit.cloud
REAPIT_PLATFORM_API_URL=https://platform.reapit.cloud

Instead of the .env file, you can also set the credentials using the reapit module configuration:

// `nuxt.config.ts`
export default defineNuxtConfig({
  modules: ['nuxt-reapit'],

  reapit: {
    connect: {
      clientId: '',
      clientSecret: '',
      // Default values
      apiUrl: 'https://connect.reapit.cloud',
    },
    platform: {
      // Default values
      apiUrl: 'https://platform.reapit.cloud',
    },
  }
})

Finally, you can use the useReapit composable to fetch data from the Reapit Platform API:

// Fetch all properties with images
const { data } = await useReapit('properties', {
  customerId: 'SBOX',
  query: {
    embed: 'images',
    marketingMode: 'selling',
  },
})

const properties = computed(() => data.value?._embedded || [])

!NOTE Don't forget to set your customerId. It becomes available to view after a customer has chosen to install your application.

💻 Development

  1. Clone this repository
  2. Enable Corepack using corepack enable
  3. Install dependencies using pnpm install
  4. Run pnpm run dev:prepare
  5. Start development server using pnpm run dev

License

MIT License © 2023-PRESENT Johann Schopplich

0.2.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago