0.0.10 • Published 3 years ago

vue-supa v0.0.10

Weekly downloads
19
License
MIT
Repository
github
Last release
3 years ago

Improt Vuex plugin

import { VuexSupa } from 'vue-supa'
new Vuex.Store({
    state: { ... },
    mutations: { ... },
    actions: { ... },
    modules: { ... },
    plugins: [
        ...,
        VuexSupa({
            supabaseUrl: 'https://....supabase.co',
            supabaseKey: '...',
            tables: [
                { name: 'messages', select: '*, author:user_id(username)', orderBy: 'id' },
                'users',
            ]
        })
    ]
}

Usage

this.$db('messages') // realtime messages
this.$auth // for retrieving the authenticated user
<div v-if="$auth.check">
    <h4>Hello, {{ $auth.email }}</h4>
    <button @click="$auth.signOut()" class="btn btn-sm btn-danger">Sign out</button>
    <ul>
        <li v-for="todo in $db('todos')" :key="todo.id">
            <label class="form-check-label">
                <input 
                    class="form-check-input"
                    type="checkbox"
                    :checked="todo.is_complete"
                    @change="$dbAction('todos').update(todo.id, { is_complete: !todo.is_complete })">
                <span :style="todo.is_complete ? 'text-decoration: line-through' : ''">{{ todo.task }}</span>
            </label>
            <button class="btn btn-sm btn-danger ml-2" @click="$dbAction('todos').remove(todo.id)">X</button>
        </li>
    </ul>
</div>
0.0.10

3 years ago

0.0.3

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago