Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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,