@capitalos/vue
v0.1.1
Published
Vue SDK for CapitalOS
Readme
CapitalOS for Vue
Vue components for integrating with CapitalOS
Requirements
Vue 2.7.0 or later
Installation
npm
npm install @capitalos/vueyarn
yarn add @capitalos/vuepnpm
pnpm add @capitalos/vueDocumentation
Please refer to the official docs for more details.
Usage
In order to use the components you will need to obtain a client authentication token. Refer to the CapitalOS documentation for more information.
// main.ts
import { createApp } from 'vue'
import { createCapitalOs } from '@capitalos/vue'
import App from './App.vue'
const app = createApp(App)
app.use(
createCapitalOs({
getToken: async () => {
// Call your backend which initiates login and returns a one-time token
const res = await fetch('/api/capitalos/token', { method: 'POST' })
const json = await res.json()
return json.token
},
enableLogging: true,
})
)
app.mount('#app')<!-- MyComponent.vue -->
<template>
<CardsApp @loaded="onLoaded" @error="onError" />
</template>
<script setup>
import { CardsApp } from '@capitalos/vue'
const onLoaded = () => console.log('CardsApp loaded!')
const onError = (error) => console.error('CardsApp error:', error)
</script>TypeScript support
TypeScript definitions for @capitalos/vue are built into the npm package and should be automatically picked up by your editor.
