File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1+ export * from './useKuzzle' ;
Original file line number Diff line number Diff line change 1+ import { getCurrentInstance } from 'vue' ;
2+ import { Kuzzle } from 'kuzzle-sdk' ;
3+
4+ export function useKuzzle ( ) : Kuzzle {
5+ const vueInstance = getCurrentInstance ( ) ;
6+ // Check only in development mode otherwise throw a false error
7+ if ( process . env . NODE_ENV !== 'production' && vueInstance === null ) {
8+ throw new Error (
9+ `Missing current instance. useKuzzle() must be called inside <script setup> or setup().` ,
10+ ) ;
11+ }
12+
13+ const vue = ( vueInstance as NonNullable < ReturnType < typeof getCurrentInstance > > ) . proxy ;
14+ return vue . $root . $kuzzle ;
15+ }
Original file line number Diff line number Diff line change 11import '../vue-kuzzle.d' ;
2- export * from './types ' ;
2+ export * from './composables ' ;
33export * from './helpers' ;
4+ export * from './types' ;
45export * from './plugin' ;
You can’t perform that action at this time.
0 commit comments