Skip to content
On this page

usePublicKql

WARNING

Deprecated. Please use useKql instead with the option { client: true }.

Returns KQL query data. Fetches the data directly from the Kirby instance. Requires kql.client option to be true in nuxt.config.ts.

Query responses are cached.

WARNING

Authorization credentials will be publicly visible. Also, possible CORS issues ahead if the backend is not configured properly. Use useKql if you're unsure what to do instead.

Type Declarations

See useKql.

Return Values

See useKql.

Example

vue
<script setup lang="ts">
const { data, pending, error, refresh } = await useKql(
  {
    query: 'site',
    select: ['title', 'children']
  },
  { client: true }
)
</script>

<template>
  <div>
    <h1>{{ data?.result?.title }}</h1>
    <button @click="refresh()">
      Refresh
    </button>
  </div>
</template>

Released under the MIT License.