This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk-vue / EnginexPlugin

EnginexPlugin ​

const EnginexPlugin: Plugin<[EnginexPluginOptions]>

Connects the SDK client and TanStack Query to the Vue app: exposes the client to useEnginex and useSession and installs the VueQueryPlugin (with the given queryClient or one of its own, created per app, with a staleTime of 60 s on queries).

When the session user changes (logout, login, or login with a different sub), it removes from the cache (not just invalidates) everything under ['enginex', 'user'], so one player's data is never served to another. The comparison uses status and userId: renewing the same user's tokens clears nothing. The ['enginex', 'public'] queries and the app's keys stay untouched. The session subscription is undone on app.unmount().

Throws ​

If installVueQuery is false and the queryClient is not given, or if the app already installed the VueQueryPlugin with a QueryClient different from the one the plugin would use.

Example ​

ts
const enginex = createEnginexClient({ locale: 'pt-BR' })

createApp(App).use(EnginexPlugin, { client: enginex }).mount('#app')