How to use vuex-rest-api - 2 common examples

To help you get started, we’ve selected a few vuex-rest-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github christianmalek / vuex-rest-api / tests / src / stores / posts.js View on Github external
import Vapi from "vuex-rest-api"

const posts = new Vapi({
  baseURL: "https://jsonplaceholder.typicode.com",
  state: {
    posts: []
  }
})
  .get({
    action: "getPostsWithHeaderFn",
    property: "posts",
    path: "/posts",
    headers: ({ foo }) => ({ "foo": foo })
  })
  .get({
    action: "getOptimisticPosts",
    beforeRequest: (state, { params, data }) => {
      state.posts = [1, 2, 3, 4, 5]
      console.log(params, data)
github distrochooser / distrochooser / viisi / store / index.js View on Github external
import Vapi from 'vuex-rest-api'
import Vuex from 'vuex'
import viisiConfig from '~/distrochooser.json'
const indexStore = new Vapi({
  baseURL: viisiConfig.frontend.backendUrl,
  state: {
    data: null, //for initial bulk loading
    question: null,
    answers: null,
    categories: null,
    currentCategory: null,
    givenAnswers: [],
    token: null, //session token
    sessionToken: null, //private session token
    isStarted: false,
    result: null,
    translations: null,
    locales: ['en', 'gb', 'us', 'de', 'it', 'cn'],
    voteResult: null,
    remarksAdded: false,

vuex-rest-api

A helper utility to simplify the usage of REST APIs with Vuex. Based on axios.

MIT
Latest version published 3 months ago

Package Health Score

70 / 100
Full package analysis

Popular vuex-rest-api functions

Similar packages