Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 1.42 KB

README.md

File metadata and controls

65 lines (51 loc) · 1.42 KB

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')