nuxt-reapit
v0.2.0
Published
Reapit integration for Nuxt
Downloads
15
Readme
nuxt-reapit
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
- Clone this repository
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run
pnpm run dev:prepare
- Start development server using
pnpm run dev
License
MIT License © 2023-PRESENT Johann Schopplich