An open API service indexing awesome lists of open source software.

https://github.com/johannschopplich/nuxt-reapit

🏘️ Reapit integration for Nuxt
https://github.com/johannschopplich/nuxt-reapit

Last synced: 6 months ago
JSON representation

🏘️ Reapit integration for Nuxt

Awesome Lists containing this project

README

          

# nuxt-reapit

[![npm version](https://img.shields.io/npm/v/nuxt-reapit?color=a1b858&label=)](https://www.npmjs.com/package/nuxt-reapit)

> Reapit integration for [Nuxt](https://nuxt.com).

- [✨  Release Notes](https://github.com/johannschopplich/nuxt-reapit/releases)

## Setup

```bash
# 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`:

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

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

```ini
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:

```ts
// `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:

```ts
// 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](https://github.com/nodejs/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) License © 2023-PRESENT [Johann Schopplich](https://github.com/johannschopplich)