@vuemodel/pinia-local-storage
TypeScript icon, indicating that this package has built-in type declarations

0.0.24 • Public • Published

core

Core repository for contracts and implementations of VueModel

WIP

VueModel aims to abstract the "play" between vue and the backend.

To start, it will be solely focused on using the composition API and aim to have implementations for:

I'll likely focus on support for GraphQl when those three are implemented.

A little more...

The idea, is that you'll be able to easily "sync" your frontend and backend data with code like this:

<script setup>
const { form, create, creating, error } = useModel(Todo)
</script>

<template>
<input v-model="form.title">

<button :disabled="creating" @click="create">create</button>

<span v-if="creating">creating...</span>
<span v-if="error">{{ error.message }}</span>
</template>

Yes, related data too!

const { include, fetch, fetching, errors, collection: todos } = useModelCollection(TodoList)

include.value = [
  'author',
  'todos.comments'
]

async function fetchTodos () {
  await fetch()
  console.log(errors)
  console.log(todos.value)
}

Note the consle.log(todos.value). This library will also manage state (using Vuex ORM... but state will also adhere to contracts that we'll be able to swap out!)

Code like the above always works the same way, and the final abstraction can be unified among backends! And that's the goal of this library: Frontend/Backend Unification

Stay tuned!

Readme

Keywords

Package Sidebar

Install

npm i @vuemodel/pinia-local-storage

Weekly Downloads

14

Version

0.0.24

License

MIT

Unpacked Size

65.8 kB

Total Files

7

Last publish

Collaborators

  • ldiebold