nuxt-reapit
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i nuxt-reapit

Weekly Downloads

6

Version

0.2.0

License

MIT

Unpacked Size

17.4 kB

Total Files

20

Last publish

Collaborators

  • johannschopplich