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: "",
  state: {
    posts: []
    action: "getPostsWithHeaderFn",
    property: "posts",
    path: "/posts",
    headers: ({ foo }) => ({ "foo": foo })
    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,


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

Latest version published 7 months ago

Package Health Score

59 / 100
Full package analysis

Popular vuex-rest-api functions

Similar packages

Popular JavaScript code snippets

Find secure code to use in your application or website