/vuex-c3s

A Vue library for the C3S SDK with Vuex bindings to make requests.

Primary LanguageJavaScriptMIT LicenseMIT

Vuex-C3S

What?

A small Vue plugin that integrates into your existing store, providing access to the Citizen Science API and allowing you to sync locally with your Vue site.

How

import c3s from 'vuex-c3s'

const swaggerURL = "https://swagger.petstore.io/swagger.json"
Vue.use(c3s.plugin, {store, swaggerURL})

***

user: state => state.c3s.user.currentUser

Store Structure

NB: Below, Store properties are camel case and submodules are title case

  • C3S
    • client
    • host
    • User
      • user
      • currentUser
    • Project
      • projects
      • project
      • media
      • comments
    • Activity
      • activities
      • activity
      • media
      • comments
    • Task
      • tasks
      • task
      • media
      • comments
    • Media
      • media
      • medium
    • Comments
      • comments
      • comment

Store Methods

Each module has the following methods available:

  • getPlural**(search:JSON) - Retrieve all of the model, with a query object
  • getSingular(id:String) - Retrieve a single model matching the ID
  • createSingular(model: JSON) - Create an instance of the model
  • updateSingular(model:JSON, id:String) - Update an instance of the model
  • deleteSingular(id:String) - Delete an instance of the model

e.g.:

this.$store.dispatch('c3s/tasks/getTask', 'abc4e6')