Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createStore(entities: Array, headers?: any, adapter?: Adapter) {
const database = new Database();
entities.forEach(entity => {
database.register(entity.model, entity.module || {});
});
// @ts-ignore
const executableSchema = makeExecutableSchema({
typeDefs,
resolvers
});
link = new SchemaLink({ schema: executableSchema });
VuexORM.use(VuexORMGraphQLPlugin, {
database: database,
link,
import { Database } from '@vuex-orm/core';
export const VuexOrmPluginConfig = {
/**
* Default VuexORM Database
* @param {Database} Instance of VuexORM database
*/
database: new Database(),
/**
* @param {string} Default DataStore prefix
*/
name: 'vuex', // Keep for backward compatibilities
/**
* @param {object} localforage config
*/
localforage: {
name: 'vuex',
},
/**
*
*/
500: this.onServerError
}
if (response && response.status in errorTypes) {
errorTypes[response.status](error);
} else {
this.onGenericError(error);
}
return Promise.reject(error);
},
};
export const VuexOrmPluginConfig = {
/**
* Default VuexORM Database
*/
database: new Database(),
/**
* Default Axios Config
*/
http: AxiosRequestConfig
};
export const ModuleConfig = {
/**
* Vuex Default Getters
*/
getters: {
loading: state => state.loading,
errors: state => state.errors,
},
import VuexORM, { Database } from '@vuex-orm/core'
import VuexORMGraphQLPlugin, {
DefaultAdapter,
ConnectionMode
} from '@vuex-orm/plugin-graphql'
import orm from '~/orm'
import apolloClient from '~/plugins/apollo-client'
class CustomAdapter extends DefaultAdapter {
getConnectionMode() {
return ConnectionMode.PLAIN
}
}
const database = new Database()
Object.values(orm)
.filter(model => !!model.entity)
.forEach(model => database.register(model))
const options = {
adapter: new CustomAdapter(),
apolloClient,
database,
debug: process.env.NODE_ENV !== 'production'
}
VuexORM.use(VuexORMGraphQLPlugin, options)
export default ({ store }, inject) => {
VuexORM.install(database)(store)